public static AuthServer[] GetAuthServerByType(AuthServerType type) { ADSessionSettings sessionSettings = ADSessionSettings.FromRootOrgScopeSet(); IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, sessionSettings, 374, "GetAuthServerByType", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\OAuth\\OAuthConfigHelper.cs"); return(tenantOrTopologyConfigurationSession.Find <AuthServer>(null, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, AuthServerSchema.Type, type), null, ADGenericPagedReader <AuthServer> .DefaultPageSize)); }
private static bool IsOneOfAuthServerTypes(AuthServerType thisType, params AuthServerType[] authServerTypes) { foreach (AuthServerType authServerType in authServerTypes) { if (authServerType == thisType) { return(true); } } return(false); }
public static void SetEndpointsIfWSFed(AuthMetadata authData, AuthServerType authServerType, string authMetadataUrl) { AuthMetadataParser.MetadataDocType metadataDocType = AuthMetadataParser.DecideMetadataDocumentType(authMetadataUrl); if (metadataDocType != AuthMetadataParser.MetadataDocType.WSFedMetadata) { return; } Uri uri = new Uri(authMetadataUrl); authData.AuthorizationEndpoint = string.Format("{0}/{1}/oauth2/authorize", uri.GetLeftPart(UriPartial.Authority), (authServerType == AuthServerType.ADFS) ? "adfs" : "common"); authData.IssuingEndpoint = string.Format("{0}/{1}/oauth2/token", uri.GetLeftPart(UriPartial.Authority), (authServerType == AuthServerType.ADFS) ? "adfs" : "common"); }