AuthenticationManager for secured services internal ArcGIS Server

Discussion created by jaarons47 on Jun 17, 2019
Latest reply on Jun 20, 2019 by XWu-esristaff

I have a question regarding AuthenticationManager when pointed at internal secured services (on internal ArcGIS Token Authentication Service).  Can I use AuthenticationManager against such services in Android?  All the samples I see for Android are used with Portal, not with an individual secured feature service pointed at internal ArcGIS Server.  Getting Portal to authenticate is a breeze as follows....


final AuthenticationChallengeHandler handler = new DefaultAuthenticationChallengeHandler(activity.get());
final OAuthConfiguration oAC = new OAuthConfiguration(urlLogin, Client_ID2, "my-arcgis-app://auth", OAUTH_EXPIRATION_NEVER);




I see a couple of methods in .NET which I also cannot seem to get to work in a WPF project that do not seem available in Android....Seems strange I would need to provide a client re-direct for a secured service...Thought that was only for portal?



OAuth authorization

// define server info for an OAuth (authorization code) server var serverInfo = new ServerInfo { ServerUri = new Uri(ServerUrl), TokenAuthenticationType = TokenAuthenticationType.OAuthAuthorizationCode, OAuthClientInfo = new OAuthClientInfo { ClientId = ClientId, ClientSecret = ClientSecret, RedirectUri = new Uri(RedirectUrl) } }; // register the portal with authentication manager AuthenticationManager.Current.RegisterServer(serverInfo);


HTTP (integrated Windows authentication) authorization

// Create a hard-coded network credential ArcGISNetworkCredential hardcodedCredential = new ArcGISNetworkCredential { Credentials = new System.Net.NetworkCredential(NetworkUsername, NetworkPassword, NetworkDomain), ServiceUri = new Uri(SecuredPortalUrl) }; // Add the credential to the AuthenticationManager and report that a non-default credential is being used AuthenticationManager.Current.AddCredential(hardcodedCredential);