Пример #1
0
        public OidcTokenResponse CreateTokenResponse(StoredGrant grant, int accessTokenLifetime)
        {
            var accessToken = CreateAccessToken(grant.Subject, _issuer + "/userinfo", grant.ClientId, grant.Scopes,
                accessTokenLifetime);
            var response = new OidcTokenResponse
            {
                AccessToken = accessToken.ToJwtString(),
                TokenType = "Bearer",
                ExpiresIn = accessTokenLifetime*60
            };

            if (grant.GrantType == StoredGrantType.AuthorizationCode)
            {
                var idToken = CreateIdentityToken(grant.Subject, grant.ClientId, 60);
                response.IdentityToken = idToken.ToJwtString();
            }

            return response;
        }
Пример #2
0
        public OidcTokenResponse CreateTokenResponse(StoredGrant grant, int accessTokenLifetime)
        {
            var accessToken = CreateAccessToken(grant.Subject, _issuer + "/userinfo", grant.ClientId, grant.Scopes,
                                                accessTokenLifetime);
            var response = new OidcTokenResponse
            {
                AccessToken = accessToken.ToJwtString(),
                TokenType   = "Bearer",
                ExpiresIn   = accessTokenLifetime * 60
            };

            if (grant.GrantType == StoredGrantType.AuthorizationCode)
            {
                var idToken = CreateIdentityToken(grant.Subject, grant.ClientId, 60);
                response.IdentityToken = idToken.ToJwtString();
            }

            return(response);
        }
Пример #3
0
 public static HttpResponseMessage CreateTokenResponse(this HttpRequestMessage request,
     OidcTokenResponse response)
 {
     Tracing.Information("Returning token response.");
     return request.CreateResponse(HttpStatusCode.OK, response);
 }