AnsweredAssumed Answered

How to generate long term tokens / tokens with a specified timeout?

Question asked by ti@rapidis.com on Sep 16, 2014
Latest reply on Nov 20, 2014 by ti@rapidis.com

I have this function, which is called from MainWindow():

 

private async void GenerateToken()
{
//Get token to be used for secure access

IdentityManager.Current.DefaultReferer = "BlahBlah";
IdentityManager.Current.ChallengeMethodEx += SignInDialog.DoSignInEx; 
IdentityManager.Credential crd = await IdentityManager.Current.GenerateCredentialTaskAsync("http://GisServer:6080/arcgis/rest/services", "user", "pwd");
if (crd != null)
  IdentityManager.Current.AddCredential(crd);
else
  throw new Exception("Unknown error");
}

 

 

The application invokes geoprocessing service tasks (Geoprocessor.SubmitJobAsync()) and some of those tasks can run for a very long time, so I would rather just request a token, which does not time out for like a week or something like that.

 

On the GIS server I have the short lived tokens set to 60 minutes and the long lived tokens set to 1 day. I plan to change the latter to 30 days, but I do not know how to request a token like that.

 

Also: Does this line look sensible:

IdentityManager.Current.ChallengeMethodEx += SignInDialog.DoSignInEx;

?

 

It is adapted from this forum post. I do not ever want users to see any sign in dialogs. The credentials will either be hardcoded or in a config file or something like that.

Outcomes