public ConnectController(
     IOpenIddictApplicationManager applicationManager,
     IOpenIddictAuthorizationManager authorizationManager,
     IOpenIddictScopeManager scopeManager,
     SignInManager <IdentityUser> signInManager,
     UserManager <IdentityUser> userManager)
 {
     m_ApplicationManager   = applicationManager ?? throw new ArgumentNullException(nameof(applicationManager));
     m_AuthorizationManager = authorizationManager ?? throw new ArgumentNullException(nameof(authorizationManager));
     m_ScopeManager         = scopeManager ?? throw new ArgumentNullException(nameof(scopeManager));
     m_SignInManager        = signInManager;
     m_UserManager          = userManager;
 }
Exemplo n.º 2
0
 public AuthorizationController(
     IOpenIddictApplicationManager applicationManager,
     IOpenIddictAuthorizationManager authorizationManager,
     IOpenIddictScopeManager scopeManager,
     SignInManager <ApplicationUser> signInManager,
     UserManager <ApplicationUser> userManager)
 {
     _applicationManager   = applicationManager;
     _authorizationManager = authorizationManager;
     _scopeManager         = scopeManager;
     _signInManager        = signInManager;
     _userManager          = userManager;
 }
 public OpenIddictServerProvider(
     [NotNull] ILogger <OpenIddictServerProvider> logger,
     [NotNull] IOpenIddictApplicationManager applicationManager,
     [NotNull] IOpenIddictAuthorizationManager authorizationManager,
     [NotNull] IOpenIddictScopeManager scopeManager,
     [NotNull] IOpenIddictTokenManager tokenManager)
 {
     _logger               = logger;
     _applicationManager   = applicationManager;
     _authorizationManager = authorizationManager;
     _scopeManager         = scopeManager;
     _tokenManager         = tokenManager;
 }
        public WorkplaceCredentialsService(
            IOpenIddictApplicationManager oidcAppManager,
            AuthorityDbContext authorityDbContext,
            AutoMapperConfig autoMapperConfig,
            ITenantIdProvider tenantIdProvider
            )
        {
            _rngCsp = new RNGCryptoServiceProvider();

            _oidcAppManager     = oidcAppManager;
            _tenantIdProvider   = tenantIdProvider;
            _authorityDbContext = authorityDbContext;
            _mapper             = autoMapperConfig.CreateMapper();
        }
Exemplo n.º 5
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            using IServiceScope scope = _serviceProvider.CreateScope();

            QuorraDbContext context = scope.ServiceProvider.GetRequiredService <QuorraDbContext>();
            await context.Database.EnsureCreatedAsync(cancellationToken);

            IOpenIddictApplicationManager manager = scope.ServiceProvider.GetRequiredService <IOpenIddictApplicationManager>();

            if (await manager.FindByClientIdAsync("console", cancellationToken) is null)
            {
                await manager.CreateAsync(new OpenIddictApplicationDescriptor
                {
                    ClientId     = "console",
                    ClientSecret = "388D45FA-B36B-4988-BA59-B187D329C207",
                    DisplayName  = "My client application",
                    Permissions  =
                    {
                        OpenIddictConstants.Permissions.Endpoints.Token,
                        OpenIddictConstants.Permissions.GrantTypes.ClientCredentials,
                        OpenIddictConstants.Permissions.GrantTypes.RefreshToken,
                        OpenIddictConstants.Permissions.Prefixes.Scope + "api"
                    }
                }, cancellationToken);
            }

            if (await manager.FindByClientIdAsync("postman", cancellationToken) is null)
            {
                await manager.CreateAsync(new OpenIddictApplicationDescriptor
                {
                    ClientId     = "postman",
                    ClientSecret = "postman-secret",
                    DisplayName  = "Postman",
                    RedirectUris = { new Uri("https://oauth.pstmn.io/v1/callback") },
                    Permissions  =
                    {
                        OpenIddictConstants.Permissions.Endpoints.Authorization,
                        OpenIddictConstants.Permissions.Endpoints.Token,

                        OpenIddictConstants.Permissions.GrantTypes.AuthorizationCode,
                        OpenIddictConstants.Permissions.GrantTypes.ClientCredentials,
                        OpenIddictConstants.Permissions.GrantTypes.RefreshToken,

                        OpenIddictConstants.Permissions.Prefixes.Scope + "api",
                        OpenIddictConstants.Permissions.ResponseTypes.Code
                    }
                }, cancellationToken);
            }
        }
Exemplo n.º 6
0
 public AuthorizationController(
     IOpenIddictApplicationManager applicationManager,
     IOpenIddictAuthorizationManager authorizationManager,
     IOpenIddictScopeManager scopeManager,
     SignInManager <ApplicationUser> signInManager,
     UserManager <ApplicationUser> userManager,
     IApplicationGuidFactory guidFactory,
     ConfigurationDbContext configDb)
 {
     _applicationManager   = applicationManager;
     _authorizationManager = authorizationManager;
     _scopeManager         = scopeManager;
     _signInManager        = signInManager;
     _userManager          = userManager;
     this.guidFactory      = guidFactory;
     this.configDb         = configDb;
 }
Exemplo n.º 7
0
        public static async Task AddClient(this IOpenIddictApplicationManager manager, Action <OpenIddictApplicationDescriptor> descriptor, CancellationToken cancellationToken = default)
        {
            var application = new OpenIddictApplicationDescriptor();

            descriptor(application);

            if (string.IsNullOrEmpty(application.ClientId))
            {
                throw new ArgumentNullException();
            }

            if (await manager.FindByClientIdAsync(application.ClientId, cancellationToken) is not null)
            {
                return;
            }

            await manager.CreateAsync(application, cancellationToken);
        }
Exemplo n.º 8
0
        private async static Task CreateIfNotExistAndSeedDatabase(IOpenIddictApplicationManager applicationManager)
        {
            var clientId = "BlazorApp13";
            var app      = await applicationManager.FindByClientIdAsync(clientId);

            if (app is null)
            {
                if (await applicationManager.FindByClientIdAsync(clientId) is null)
                {
                    var descriptor = new OpenIddictApplicationDescriptor
                    {
                        ClientId               = clientId,
                        DisplayName            = "Blazor App 13",
                        RedirectUris           = { new Uri($"{HOSTNAME}/authentication/login-callback") },
                        PostLogoutRedirectUris = { new Uri($"{HOSTNAME}/authentication/logout-callback") },
                        //ConsentType = OpenIddictConstants.ConsentTypes.Implicit,
                        Permissions =
                        {
                            OpenIddictConstants.Permissions.Endpoints.Authorization,
                            OpenIddictConstants.Permissions.Endpoints.Token,
                            OpenIddictConstants.Permissions.Endpoints.Logout,
                            OpenIddictConstants.Permissions.GrantTypes.AuthorizationCode,
                            OpenIddictConstants.Permissions.GrantTypes.RefreshToken,
                            OpenIddictConstants.Permissions.Scopes.Email,
                            OpenIddictConstants.Permissions.Scopes.Profile,
                            OpenIddictConstants.Permissions.Scopes.Roles
                        },
                        Requirements =
                        {
                            OpenIddictConstants.Requirements.Features.ProofKeyForCodeExchange
                        }
                    };

                    await applicationManager.CreateAsync(descriptor);
                }
            }
        }
 public AuthorizationController(IOpenIddictApplicationManager applicationManager)
 => _applicationManager = applicationManager;
Exemplo n.º 10
0
 public ResourceController(IOpenIddictApplicationManager applicationManager)
 => _applicationManager = applicationManager;
 public OpenIdApplicationController(IUserContext user, ILogger <OpenIdApplicationController> logger, IOpenIddictApplicationManager store)
 {
     _store = store;
 }
 public RegisterService(IConfiguration configuration, Validator validator, IOpenIddictApplicationManager applicationManager)
 {
     _configuration      = configuration;
     _validator          = validator;
     _applicationManager = applicationManager;
 }
Exemplo n.º 13
0
 public ApplicationController(IOpenIddictApplicationManager manager)
 {
     _manager = manager;
 }
Exemplo n.º 14
0
 public TokenService(IOpenIddictApplicationManager applicationManager)
 {
     _applicationManager = applicationManager;
 }
Exemplo n.º 15
0
 public AuthorizationController(IOpenIddictScopeManager scopeManager, IOpenIddictApplicationManager openIddictApplicationManager, IOpenIddictAuthorizationManager openIddictAuthorizationManager)
 {
     _scopeManager         = scopeManager;
     _applicationManager   = openIddictApplicationManager;
     _authorizationManager = openIddictAuthorizationManager;
 }
Exemplo n.º 16
0
 public AuthorizationController(IOpenIddictScopeManager scopeManager, IOpenIddictApplicationManager applicationManager)
 {
     this.applicationManager = applicationManager;
     this.scopeManager       = scopeManager;
 }