Пример #1
0
        public async Task <DiscoveryInformation> CreateDiscoveryInformation(string issuer, CancellationToken cancellationToken)
        {
            issuer = issuer.TrimEnd('/');
            // Returns only the exposed scopes
            var scopes = await _scopeRepository.GetAll(cancellationToken).ConfigureAwait(false);

            var scopeSupportedNames = scopes != null && scopes.Any()
                ? scopes.Where(s => s.IsExposed).Select(s => s.Name).ToArray()
                : Array.Empty <string>();

            var responseTypesSupported = GetSupportedResponseTypes(CoreConstants.Supported.SupportedAuthorizationFlows);

            var result = new DiscoveryInformation
            {
                ClaimsParameterSupported      = true,
                RequestParameterSupported     = true,
                RequestUriParameterSupported  = true,
                RequireRequestUriRegistration = true,
                ClaimsSupported                     = Array.Empty <string>(),
                ScopesSupported                     = scopeSupportedNames,
                ResponseTypesSupported              = responseTypesSupported,
                ResponseModesSupported              = CoreConstants.Supported.SupportedResponseModes.ToArray(),
                GrantTypesSupported                 = GrantTypes.All,
                SubjectTypesSupported               = CoreConstants.Supported.SupportedSubjectTypes.ToArray(),
                TokenEndpointAuthMethodSupported    = CoreConstants.Supported.SupportedTokenEndPointAuthenticationMethods,
                IdTokenSigningAlgValuesSupported    = new[] { SecurityAlgorithms.RsaSha256, SecurityAlgorithms.EcdsaSha256 },
                IdTokenEncryptionEncValuesSupported = Array.Empty <string>(),
                ClaimsLocalesSupported              = new[] { "en" },
                UiLocalesSupported                  = new[] { "en" },
                Version = _version,

                // default : implement the session management : http://openid.net/specs/openid-connect-session-1_0.html

                Issuer = new Uri(issuer),
                DeviceAuthorizationEndPoint = new Uri(issuer + "/" + CoreConstants.EndPoints.DeviceAuthorization),
                AuthorizationEndPoint       = new Uri(issuer + "/" + CoreConstants.EndPoints.Authorization),
                TokenEndPoint         = new Uri(issuer + "/" + CoreConstants.EndPoints.Token),
                UserInfoEndPoint      = new Uri(issuer + "/" + CoreConstants.EndPoints.UserInfo),
                JwksUri               = new Uri(issuer + "/" + CoreConstants.EndPoints.Jwks),
                RegistrationEndPoint  = new Uri(issuer + "/" + CoreConstants.EndPoints.Clients),
                RevocationEndPoint    = new Uri(issuer + "/" + CoreConstants.EndPoints.Revocation),
                IntrospectionEndpoint = new Uri(issuer + "/" + CoreConstants.EndPoints.Introspection),
                Jws                  = new Uri(issuer + "/" + CoreConstants.EndPoints.Jws),
                Jwe                  = new Uri(issuer + "/" + CoreConstants.EndPoints.Jwe),
                Clients              = new Uri(issuer + "/" + CoreConstants.EndPoints.Clients),
                Scopes               = new Uri(issuer + "/" + CoreConstants.EndPoints.Scopes),
                ResourceOwners       = new Uri(issuer + "/" + CoreConstants.EndPoints.ResourceOwners),
                Manage               = new Uri(issuer + "/" + CoreConstants.EndPoints.Manage),
                Claims               = new Uri(issuer + "/" + CoreConstants.EndPoints.Claims),
                CheckSessionEndPoint = new Uri(issuer + "/" + CoreConstants.EndPoints.CheckSession),
                EndSessionEndPoint   = new Uri(issuer + "/" + CoreConstants.EndPoints.EndSession),
            };

            return(result);
        }
Пример #2
0
        public async Task <Resources> GetAllResourcesAsync()
        {
            var apis = _resourceRepository.GetAll()
                       .Where(r => r.Active)
                       .Select(ResourceToApiResource)
                       .ToHashSet();

            var scopes = _scopeRepository.GetAll()
                         .Select(ScopeToApiScope)
                         .ToList();

            return(new Resources(null, apis, scopes));
        }
        public async Task <IEnumerable <string> > Execute()
        {
            try
            {
                var scopes = await _scopeRepository.GetAll();

                return(scopes.Select(s => s.Id));
            }
            catch (Exception ex)
            {
                throw new BaseUmaException(ErrorCodes.InternalError,
                                           ErrorDescriptions.TheScopesCannotBeRetrieved,
                                           ex);
            }
        }
Пример #4
0
        public async Task <IActionResult> GetAll(CancellationToken cancellationToken)
        {
            var result = await _scopeRepository.GetAll(cancellationToken).ConfigureAwait(false);

            return(new OkObjectResult(result));
        }