Esempio n. 1
0
        public async Task <IActionResult> Index(string returnUrl)
        {
            ConsentInfoDto dto = await this.BuildConsentInfoDtoAsync(returnUrl);

            if (dto != null)
            {
                return(Ok(dto));
            }

            return(BadRequest());
        }
Esempio n. 2
0
        private ConsentInfoDto CreateConsentInfoDto(
            ConsentRequestDto model,
            string returnUrl,
            AuthorizationRequest request,
            Client client,
            Resources resources)
        {
            // TODO: Remove the checked property and check everything automatically in the UI.
            var dto = new ConsentInfoDto
            {
                ReturnUrl = returnUrl,

                ClientName           = client.ClientName ?? client.ClientId,
                ClientUrl            = client.ClientUri,
                ClientLogoUrl        = client.LogoUri,
                AllowRememberConsent = client.AllowRememberConsent
            };

            dto.IdentityScopes = resources.IdentityResources
                                 .Select(x => this.CreateScopeDto(x, true))
                                 .ToArray();

            dto.ResourceScopes = resources.ApiResources
                                 .SelectMany(x => x.Scopes)
                                 .Select(x => this.CreateScopeDto(x, true))
                                 .ToArray();

            if (ConsentOptions.EnableOfflineAccess && resources.OfflineAccess)
            {
                dto.ResourceScopes = dto.ResourceScopes.Union(
                    new ScopeDto[]
                {
                    this.GetOfflineAccessScope(true)
                });
            }

            return(dto);
        }