コード例 #1
0
        public async Task <ActionResult <UmaConfiguration> > GetConfiguration(CancellationToken cancellationToken)
        {
            var absoluteUriWithVirtualPath = Request.GetAbsoluteUriWithVirtualPath();
            var scopes = await _scopeStore.GetAll(cancellationToken).ConfigureAwait(false);

            var scopeSupportedNames = scopes != null && scopes.Any()
                ? scopes.Where(s => s.IsExposed).Select(s => s.Name).ToArray()
                : Array.Empty <string>();
            var result = new UmaConfiguration
            {
                ClaimTokenProfilesSupported  = Array.Empty <string>(),
                UmaProfilesSupported         = UmaProfilesSupported,
                ResourceRegistrationEndpoint = new Uri(absoluteUriWithVirtualPath + '/' + UmaConstants.RouteValues.ResourceSet),
                PermissionEndpoint           = new Uri(absoluteUriWithVirtualPath + '/' + UmaConstants.RouteValues.Permission),
                ScopesSupported = scopeSupportedNames,
                //PoliciesEndpoint = absoluteUriWithVirtualPath + PolicyApi,
                // OAUTH2.0
                Issuer = new Uri(absoluteUriWithVirtualPath),
                AuthorizationEndpoint = new Uri(absoluteUriWithVirtualPath + '/' + CoreConstants.EndPoints.Authorization),
                TokenEndpoint         = new Uri(absoluteUriWithVirtualPath + '/' + CoreConstants.EndPoints.Token),
                JwksUri = new Uri(absoluteUriWithVirtualPath + '/' + CoreConstants.EndPoints.Jwks),
                RegistrationEndpoint   = new Uri(absoluteUriWithVirtualPath + '/' + CoreConstants.EndPoints.Clients),
                IntrospectionEndpoint  = new Uri(absoluteUriWithVirtualPath + '/' + UmaConstants.RouteValues.Introspection),
                RevocationEndpoint     = new Uri(absoluteUriWithVirtualPath + '/' + CoreConstants.EndPoints.Token + "/revoke"),
                UiLocalesSupported     = new[] { "en" },
                GrantTypesSupported    = GrantTypes.All,
                ResponseTypesSupported = ResponseTypeNames.All
            };

            return(new OkObjectResult(result));
        }