Ejemplo n.º 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());
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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
     }
 }
Ejemplo n.º 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.");
     }
 }
Ejemplo n.º 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);
        }