Beispiel #1
0
 public CasGoogleId(
     ILogger <CasGoogleId> logger,
     CasTokenIssuer tokenIssuer,
     ICasClaimsBuilder claimsBuilder       = null,
     ICasAuthCodeReceiver authCodeReceiver = null
     ) : base(logger, tokenIssuer, claimsBuilder, authCodeReceiver)
 {
     this.ConfigManager = new ConfigurationManager <OpenIdConnectConfiguration>("https://accounts.google.com/.well-known/openid-configuration", new OpenIdConnectConfigurationRetriever());
 }
Beispiel #2
0
 public CasIdp(
     ILogger logger,
     CasTokenIssuer tokenIssuer,
     ICasClaimsBuilder claimsBuilder       = null,
     ICasAuthCodeReceiver authCodeReceiver = null
     )
 {
     this.Logger           = logger;
     this.TokenIssuer      = tokenIssuer;
     this.ClaimsBuilder    = claimsBuilder;
     this.AuthCodeReceiver = authCodeReceiver;
 }
Beispiel #3
0
 public static async Task ReceiveAll(this ICasAuthCodeReceiver receiver, string scope, string accessToken, string refreshToken)
 {
     try
     {
         receiver.Receive(scope, accessToken, refreshToken);
     }
     catch (NotImplementedException)
     {
         // ignore, it is OK to not be implemented
     }
     try
     {
         await receiver.ReceiveAsync(scope, accessToken, refreshToken);
     }
     catch (NotImplementedException)
     {
         // ignore, it is OK to not be implemented
     }
 }
Beispiel #4
0
 public CasAzureAd(
     ILogger <CasAzureAd> logger,
     IConfig config,
     CasTokenIssuer tokenIssuer,
     IHttpClientFactory httpClientFactory,
     IAccessTokenFetcher accessTokenFetcher,
     ICasClaimsBuilder claimsBuilder       = null,
     ICasAuthCodeReceiver authCodeReceiver = null
     ) : base(logger, tokenIssuer, claimsBuilder, authCodeReceiver)
 {
     this.ConfigManager      = new ConfigurationManager <OpenIdConnectConfiguration>($"{CasConfig.AzureAuthority}/.well-known/openid-configuration", new OpenIdConnectConfigurationRetriever());
     this.HttpClient         = httpClientFactory.CreateClient("cas");
     this.AccessTokenFetcher = accessTokenFetcher;
     this.Config             = config as CasConfig;
     if (this.Config == null)
     {
         throw new Exception("CasAzureAd: CasConfig was not found in the IServiceCollection.");
     }
 }
Beispiel #5
0
        public static async Task <List <string> > GetAllScopes(this ICasAuthCodeReceiver receiver)
        {
            var list = new List <string>();

            try
            {
                list.AddRange(receiver.GetScopes());
            }
            catch (NotImplementedException)
            {
                // ignore, it is OK to not be implemented
            }
            try
            {
                list.AddRange(await receiver.GetScopesAsync());
            }
            catch (NotImplementedException)
            {
                // ignore, it is OK to not be implemented
            }
            return(list);
        }