示例#1
0
        static async Task <RefreshToken> Version2(BsonDocument doc, TokenSerializer tokenSerializer, ClaimSetSerializer claimsSerializer)
        {
            var       token = new RefreshToken();
            BsonValue at;

            if (doc.TryGetValue("accessToken", out at))
            {
                token.AccessToken = await tokenSerializer.Deserialize(at.AsBsonDocument);
            }
            token.CreationTime = doc.GetValueOrDefault("creationTime", token.CreationTime);
            token.LifeTime     = doc.GetValueOrDefault("lifetime", token.LifeTime);
            token.Version      = doc.GetValueOrDefault("version", token.Version);
            var claims = doc.GetNestedValueOrDefault("subjectClaims", claimsSerializer.Deserialize, new Claim[] {});

            token.Subject = new ClaimsPrincipal(new ClaimsIdentity(claims));
            return(token);
        }
示例#2
0
 public RefreshTokenSerializer(IClientStore clientStore)
 {
     _tokenSerializer    = new TokenSerializer(clientStore);
     _claimSetSerializer = new ClaimSetSerializer();
 }