public virtual async Task<IEnumerable<Claim>> GetIdentityTokenClaimsAsync(ClaimsPrincipal subject, Client client, IEnumerable<Scope> scopes, CoreSettings settings, bool includeAllIdentityClaims, IUserService users, NameValueCollection request)
        {
            Logger.Debug("Getting claims for identity token");

            List<Claim> outputClaims = new List<Claim>(GetStandardSubjectClaims(subject));
            var additionalClaims = new List<string>();

            // fetch all identity claims that need to go into the id token
            foreach (var scope in scopes)
            {
                if (scope.IsOpenIdScope)
                {
                    foreach (var scopeClaim in scope.Claims)
                    {
                        if (includeAllIdentityClaims || scopeClaim.AlwaysIncludeInIdToken)
                        {
                            additionalClaims.Add(scopeClaim.Name);
                        }
                    }
                }
            }

            if (additionalClaims.Count > 0)
            {
                var claims = await users.GetProfileDataAsync(subject.GetSubjectId(), additionalClaims);
                if (claims != null)
                {
                    outputClaims.AddRange(claims);
                }
            }

            return outputClaims;
        }
 public UserInfoResponseGenerator(IUserService users, IScopeService scopes, CoreSettings settings, ILogger logger)
 {
     _users = users;
     _scopes = scopes;
     _settings = settings;
     _logger = logger;
 }
 public TokenValidator(CoreSettings settings, IUserService users, ITokenHandleStore tokenHandles, ILogger logger)
 {
     _settings = settings;
     _users = users;
     _tokenHandles = tokenHandles;
     _logger = logger;
 }
 public AuthorizeResponseGenerator(ITokenService tokenService, IAuthorizationCodeStore authorizationCodes, ITokenHandleStore tokenHandles, CoreSettings settings)
 {
     _tokenService = tokenService;
     _authorizationCodes = authorizationCodes;
     _tokenHandles = tokenHandles;
     _settings = settings;
 }
 public DefaultTokenService(IUserService users, CoreSettings settings, IClaimsProvider claimsProvider, ITokenHandleStore tokenHandles)
 {
     _users = users;
     _settings = settings;
     _claimsProvider = claimsProvider;
     _tokenHandles = tokenHandles;
 }
 public AuthorizeInteractionResponseGenerator(CoreSettings core, IConsentService consent)
 {
     _signIn = new SignInMessage();
     
     _core = core;
     _consent = consent;
 }
        public static AuthorizeRequestValidator CreateAuthorizeValidator(
            CoreSettings settings = null,
            IScopeService scopes = null,
            IClientService clients = null,
            IUserService users = null,
            ICustomRequestValidator customValidator = null)
        {
            if (settings == null)
            {
                settings = new TestSettings();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeService(TestScopes.Get());
            }

            if (clients == null)
            {
                clients = new InMemoryClientService(TestClients.Get());
            }

            if (customValidator == null)
            {
                customValidator = new DefaultCustomRequestValidator();
            }

            if (users == null)
            {
                users = new TestUserService();
            }

            return new AuthorizeRequestValidator(settings, scopes, clients, users, customValidator);
        }
        public static TokenRequestValidator CreateTokenValidator(
            CoreSettings settings = null,
            IScopeService scopes = null,
            IAuthorizationCodeStore authorizationCodeStore = null,
            IUserService userService = null,
            IAssertionGrantValidator assertionGrantValidator = null,
            ICustomRequestValidator customRequestValidator = null)
        {
            if (settings == null)
            {
                settings = new TestSettings();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeService(TestScopes.Get());
            }

            if (userService == null)
            {
                userService = new TestUserService();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomRequestValidator();
            }

            if (assertionGrantValidator == null)
            {
                assertionGrantValidator = new TestAssertionValidator();
            }

            return new TokenRequestValidator(settings, authorizationCodeStore, userService, scopes, assertionGrantValidator, customRequestValidator);
        }
 public TokenRequestValidator(CoreSettings settings, IAuthorizationCodeStore authorizationCodes, IUserService users, IScopeService scopes, IAssertionGrantValidator assertionValidator, ICustomRequestValidator customRequestValidator)
 {
     _settings = settings;
     _authorizationCodes = authorizationCodes;
     _users = users;
     _scopes = scopes;
     _assertionValidator = assertionValidator;
     _customRequestValidator = customRequestValidator;
 }
        public AuthorizeRequestValidator(CoreSettings core, IScopeService scopes, IClientService clients, IUserService users, ICustomRequestValidator customValidator)
        {
            _core = core;
            _scopes = scopes;
            _clients = clients;
            _users = users;
            _customValidator = customValidator;

            _validatedRequest = new ValidatedAuthorizeRequest();
            _validatedRequest.CoreSettings = _core;
        }
        public virtual Task<IEnumerable<Claim>> GetAccessTokenClaimsAsync(ClaimsPrincipal subject, Client client, IEnumerable<Scope> scopes, CoreSettings settings, IUserService users, NameValueCollection request)
        {
            var claims = new List<Claim>
            {
                new Claim(Constants.ClaimTypes.ClientId, client.ClientId),
            };

            foreach (var scope in scopes)
            {
                claims.Add(new Claim(Constants.ClaimTypes.Scope, scope.Name));
            }

            if (subject != null)
            {
                claims.AddRange(GetStandardSubjectClaims(subject));
            }

            return Task.FromResult<IEnumerable<Claim>>(claims);
        }
 public UserInfoEndpointController(CoreSettings settings, TokenValidator tokenValidator, UserInfoResponseGenerator generator)
 {
     _tokenValidator = tokenValidator;
     _generator = generator;
     _settings = settings;
 }
 public DiscoveryEndpointController(CoreSettings settings, IScopeService scopes)
 {
     _settings = settings;
     _scopes = scopes;
 }
 public LogoutController(ILogger logger, CoreSettings settings)
 {
     this.logger = logger;
     this.settings = settings;
 }
 public MetadataResponseGenerator(ILogger logger, CoreSettings settings)
 {
     _logger = logger;
     _settings = settings;
 }
 public SignInResponseGenerator(ILogger logger, CoreSettings settings, IUserService users)
 {
     _logger = logger;
     _settings = settings;
     _users = users;
 }