示例#1
0
 public OpenIdConnectRedirectProvider(IMetadataService metadataService, NavigationManager navigationManager, OpenIdConnectMetadataConfigurationOptions options, ITokenProvider tokenProvider)
 {
     this.metadataService   = metadataService;
     this.navigationManager = navigationManager;
     this.options           = options;
     this.tokenProvider     = tokenProvider;
 }
示例#2
0
        public static IServiceCollection UseOpenIdConnectAuthentication(this IServiceCollection services, string oidcServer, string clientId, string redirectPath, params string[] scopes)
        {
            var options = new OpenIdConnectMetadataConfigurationOptions($"{oidcServer}/.well-known/openid-configuration", clientId, redirectPath, scopes);

            services.AddSingleton(options);

            services.AddSingleton <IMetadataService, OpenIdConnectMetadataService>();
            services.AddSingleton <ITokenProvider, DefaultTokenProvider>();
            services.AddSingleton <OpenIdConnectRedirectProvider>();
            services.AddScoped <AuthenticationStateProvider, OpenIdConnectAuthenticationStateProvider>();

            return(services);
        }
示例#3
0
 public OpenIdConnectMetadataService(HttpClient client, OpenIdConnectMetadataConfigurationOptions options)
 {
     this.client  = client;
     this.options = options;
 }