private static void RegisterDependencies(
            IServiceCollection serviceCollection,
            UmaServerOptions umaServerOptions)
        {
            serviceCollection.AddTransient <IResourceSetActions, ResourceSetActions>();
            serviceCollection.AddTransient <IAddResourceSetAction, AddResourceSetAction>();
            serviceCollection.AddTransient <IGetResourceSetAction, GetResourceSetAction>();
            serviceCollection.AddTransient <IUpdateResourceSetAction, UpdateResourceSetAction>();
            serviceCollection.AddTransient <IDeleteResourceSetAction, DeleteResourceSetAction>();
            serviceCollection.AddTransient <IGetAllResourceSetAction, GetAllResourceSetAction>();
            serviceCollection.AddTransient <IResourceSetParameterValidator, ResourceSetParameterValidator>();
            serviceCollection.AddTransient <IGetScopeAction, GetScopeAction>();
            serviceCollection.AddTransient <IScopeActions, ScopeActions>();
            serviceCollection.AddTransient <IScopeParameterValidator, ScopeParameterValidator>();
            serviceCollection.AddTransient <IInsertScopeAction, InsertScopeAction>();
            serviceCollection.AddTransient <IScopeActions, ScopeActions>();
            serviceCollection.AddTransient <IUpdateScopeAction, UpdateScopeAction>();
            serviceCollection.AddTransient <IDeleteScopeAction, DeleteScopeAction>();
            serviceCollection.AddTransient <IGetScopesAction, GetScopesAction>();
            serviceCollection.AddTransient <IPermissionControllerActions, PermissionControllerActions>();
            serviceCollection.AddTransient <IAddPermissionAction, AddPermissionAction>();
            serviceCollection.AddTransient <IRepositoryExceptionHelper, RepositoryExceptionHelper>();
            serviceCollection.AddTransient <IGetAuthorizationAction, GetAuthorizationAction>();
            serviceCollection.AddTransient <IAuthorizationPolicyValidator, AuthorizationPolicyValidator>();
            serviceCollection.AddTransient <IBasicAuthorizationPolicy, BasicAuthorizationPolicy>();
            serviceCollection.AddTransient <ICustomAuthorizationPolicy, CustomAuthorizationPolicy>();
            serviceCollection.AddTransient <IAuthorizationActions, AuthorizationActions>();
            serviceCollection.AddTransient <IAddAuthorizationPolicyAction, AddAuthorizationPolicyAction>();
            serviceCollection.AddTransient <IPolicyActions, PolicyActions>();
            serviceCollection.AddTransient <IGetAuthorizationPolicyAction, GetAuthorizationPolicyAction>();
            serviceCollection.AddTransient <IDeleteAuthorizationPolicyAction, DeleteAuthorizationPolicyAction>();
            serviceCollection.AddTransient <IGetAuthorizationPoliciesAction, GetAuthorizationPoliciesAction>();
            serviceCollection.AddTransient <IUpdatePolicyAction, UpdatePolicyAction>();
            serviceCollection.AddTransient <IConfigurationActions, ConfigurationActions>();
            serviceCollection.AddTransient <IGetConfigurationAction, GetConfigurationAction>();
            serviceCollection.AddTransient <IGetIntrospectAction, GetIntrospectAction>();
            serviceCollection.AddTransient <IIntrospectionActions, IntrospectionActions>();
            serviceCollection.AddTransient <IGetBackendCodeAction, GetBackendCodeAction>();
            serviceCollection.AddTransient <ICodeProvider, CodeProvider>();
            serviceCollection.AddTransient <ICodeSampleActions, CodeSampleActions>();
            serviceCollection.AddTransient <IGetFrontendCodeAction, GetFrontendCodeAction>();
            serviceCollection.AddTransient <IIdentityServerClientFactory, IdentityServerClientFactory>();
            serviceCollection.AddTransient <IJwtTokenParser, JwtTokenParser>();
            serviceCollection.AddTransient <IAddResourceSetToPolicyAction, AddResourceSetToPolicyAction>();
            serviceCollection.AddTransient <IDeleteResourcePolicyAction, DeleteResourcePolicyAction>();
            serviceCollection.AddTransient <IGetPoliciesAction, GetPoliciesAction>();
            if (umaServerOptions.ConfigurationService == null)
            {
                serviceCollection.AddTransient <IConfigurationService, DefaultConfigurationService>();
            }
            else
            {
                serviceCollection.AddSingleton <IConfigurationService>(umaServerOptions.ConfigurationService);
            }

            serviceCollection.AddSimpleIdentityServerJwt();
        }
        public static IServiceCollection AddSimpleIdServerUmaCore(
            this IServiceCollection serviceCollection,
            UmaServerOptions options = null)
        {
            if (options == null)
            {
                options = new UmaServerOptions();
            }

            RegisterDependencies(serviceCollection, options);
            return(serviceCollection);
        }
        public static IServiceCollection AddSimpleIdServerUmaCore(
            this IServiceCollection serviceCollection,
            Action <UmaServerOptions> callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            var umaServerOptions = new UmaServerOptions();

            callback(umaServerOptions);
            RegisterDependencies(serviceCollection, umaServerOptions);
            return(serviceCollection);
        }
Пример #4
0
        private static void RegisterDependencies(
            IServiceCollection serviceCollection,
            UmaServerOptions umaServerOptions)
        {
            serviceCollection.AddTransient <IResourceSetActions, ResourceSetActions>();
            serviceCollection.AddTransient <IAddResourceSetAction, AddResourceSetAction>();
            serviceCollection.AddTransient <IGetResourceSetAction, GetResourceSetAction>();
            serviceCollection.AddTransient <IUpdateResourceSetAction, UpdateResourceSetAction>();
            serviceCollection.AddTransient <IDeleteResourceSetAction, DeleteResourceSetAction>();
            serviceCollection.AddTransient <IGetAllResourceSetAction, GetAllResourceSetAction>();
            serviceCollection.AddTransient <IResourceSetParameterValidator, ResourceSetParameterValidator>();
            serviceCollection.AddTransient <IPermissionControllerActions, PermissionControllerActions>();
            serviceCollection.AddTransient <IAddPermissionAction, AddPermissionAction>();
            serviceCollection.AddTransient <IRepositoryExceptionHelper, RepositoryExceptionHelper>();
            serviceCollection.AddTransient <IAuthorizationPolicyValidator, AuthorizationPolicyValidator>();
            serviceCollection.AddTransient <IBasicAuthorizationPolicy, BasicAuthorizationPolicy>();
            serviceCollection.AddTransient <ICustomAuthorizationPolicy, CustomAuthorizationPolicy>();
            serviceCollection.AddTransient <IAddAuthorizationPolicyAction, AddAuthorizationPolicyAction>();
            serviceCollection.AddTransient <IPolicyActions, PolicyActions>();
            serviceCollection.AddTransient <IGetAuthorizationPolicyAction, GetAuthorizationPolicyAction>();
            serviceCollection.AddTransient <IDeleteAuthorizationPolicyAction, DeleteAuthorizationPolicyAction>();
            serviceCollection.AddTransient <IGetAuthorizationPoliciesAction, GetAuthorizationPoliciesAction>();
            serviceCollection.AddTransient <IUpdatePolicyAction, UpdatePolicyAction>();
            serviceCollection.AddTransient <IConfigurationActions, ConfigurationActions>();
            serviceCollection.AddTransient <IGetConfigurationAction, GetConfigurationAction>();
            serviceCollection.AddTransient <IJwtTokenParser, JwtTokenParser>();
            serviceCollection.AddTransient <IAddResourceSetToPolicyAction, AddResourceSetToPolicyAction>();
            serviceCollection.AddTransient <IDeleteResourcePolicyAction, DeleteResourcePolicyAction>();
            serviceCollection.AddTransient <IGetPoliciesAction, GetPoliciesAction>();
            serviceCollection.AddTransient <ISearchAuthPoliciesAction, SearchAuthPoliciesAction>();
            serviceCollection.AddTransient <ISearchResourceSetOperation, SearchResourceSetOperation>();
            if (umaServerOptions.ConfigurationService == null)
            {
                serviceCollection.AddTransient <IConfigurationService, DefaultConfigurationService>();
            }
            else
            {
                serviceCollection.AddSingleton <IConfigurationService>(umaServerOptions.ConfigurationService);
            }

            serviceCollection.AddTransient <IUmaTokenActions, UmaTokenActions>();
            serviceCollection.AddTransient <IGetTokenByTicketIdAction, GetTokenByTicketIdAction>();
        }