Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 private static bool IsOneOfAuthServerTypes(AuthServerType thisType, params AuthServerType[] authServerTypes)
 {
     foreach (AuthServerType authServerType in authServerTypes)
     {
         if (authServerType == thisType)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 3
0
        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");
        }