Exemple #1
0
        public static IServiceCollection AddEndpoints(this IServiceCollection services, EndpointOptions endpoints)
        {
            var map = new Dictionary<string, Type>();
            if (endpoints.EnableTokenEndpoint)
            {
                map.Add(Constants.RoutePaths.Oidc.Token, typeof(TokenEndpoint));
            }
            if (endpoints.EnableDiscoveryEndpoint)
            {
                map.Add(Constants.RoutePaths.Oidc.DiscoveryConfiguration, typeof(DiscoveryEndpoint));
            }
            if (endpoints.EnableUserInfoEndpoint)
            {
                map.Add(Constants.RoutePaths.Oidc.UserInfo, typeof(UserInfoEndpoint));
            }
            if (endpoints.EnableIntrospectionEndpoint)
            {
                map.Add(Constants.RoutePaths.Oidc.Introspection, typeof(IntrospectionEndpoint));
            }
            if (endpoints.EnableAuthorizeEndpoint)
            {
                map.Add(Constants.RoutePaths.Oidc.Authorize, typeof(AuthorizeEndpoint));
            }

            services.AddSingleton<IEndpointRouter>(new EndpointRouter(map));
            foreach (var item in map)
            {
                services.AddTransient(item.Value);
            }

            return services;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IdentityServerOptions"/> class with default values.
        /// </summary>
        public IdentityServerOptions()
        {
            SiteName = Constants.IdentityServerName;

            ProtocolLogoutUrls = new List<string>();
            RequireSsl = true;
            Endpoints = new EndpointOptions();
            AuthenticationOptions = new AuthenticationOptions();
            CspOptions = new CspOptions();
            EventsOptions = new EventsOptions();
            EnableWelcomePage = true;
            InputLengthRestrictions = new InputLengthRestrictions();
            DiscoveryOptions = new DiscoveryOptions();
        }