Я использую этот Angular Lib для потока кода OpenID Connect с PKCE для создания SPA с аутентификацией openid connect. Далее я использую идентификационный сервер 4 .
Конфигурация OIDC в SPA
{
"stsServer": "http://localhost:5000",
"redirect_url": "http://localhost:4200",
"client_id": "angularclient",
"response_type": "code",
"scope": "openid profile email address phone api1",
"post_logout_redirect_uri": "http://localhost:4200",
"start_checksession": true,
"silent_renew": true,
"silent_renew_url": "http://localhost:4200/silent-renew.html",
"post_login_route": "/home",
"forbidden_route": "/forbidden",
"unauthorized_route": "/unauthorized",
"log_console_warning_active": true,
"log_console_debug_active": true,
"max_id_token_iat_offset_allowed_in_seconds": 10
}
OIDC Config of Identiy Server
new Client
{
ClientName = "angularclient",
ClientId = "angularclient",
AccessTokenType = AccessTokenType.Reference,
// RequireConsent = false,
AccessTokenLifetime = 3600,// 330 seconds, default 60 minutes
IdentityTokenLifetime = 3600,
RequireClientSecret = false,
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
AllowAccessTokensViaBrowser = true,
RedirectUris = new List<string>
{
"http://localhost:4200",
"http://localhost:4200/callback.html",
"http://localhost:4200/silent-renew.html"
},
PostLogoutRedirectUris = new List<string>
{
"http://localhost:4200/",
"http://localhost:4200"
},
AllowedCorsOrigins = new List<string>
{
"http://localhost:4200"
},
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
IdentityServerConstants.StandardScopes.Address,
IdentityServerConstants.StandardScopes.Phone,
"api1"
}
}
Когда я обращаюсь к userinfo_endpoint, возвращается только подпретензия.
{ "sub": "818727" }
Чего мне не хватает в моей конфигурации? Нужно ли настраивать заявки, возвращаемые из userinfo_endpoint?