コード例 #1
0
ファイル: Mappings.cs プロジェクト: azhuang88/IdentityServer
 public static Models.CodeToken ToDomainModel(this CodeToken token)
 {
     return(new Models.CodeToken
     {
         ClientId = token.ClientId,
         Scope = token.Scope,
         UserName = token.UserName,
         Code = token.Code,
         Type = (CodeTokenType)token.Type,
         TimeStamp = token.TimeStamp
     });
 }
コード例 #2
0
        public string AddCode(CodeTokenType type, int clientId, string userName, string scope)
        {
            using (var entities = IdentityServerConfigurationContext.Get())
            {
                var code = Guid.NewGuid().ToString("N");

                var refreshToken = new CodeToken
                {
                    Type = (int) type,
                    Code = code,
                    ClientId = clientId,
                    Scope = scope,
                    UserName = userName,
                    TimeStamp = DateTime.UtcNow
                };

                entities.CodeTokens.Add(refreshToken);
                entities.SaveChanges();

                return code;
            }
        }
コード例 #3
0
        public string AddCode(CodeTokenType type, int clientId, string userName, string scope)
        {
            using (var entities = IdentityServerConfigurationContext.Get())
            {
                var code = Guid.NewGuid().ToString("N");

                var refreshToken = new CodeToken
                {
                    Type      = (int)type,
                    Code      = code,
                    ClientId  = clientId,
                    Scope     = scope,
                    UserName  = userName,
                    TimeStamp = DateTime.UtcNow
                };

                entities.CodeTokens.Add(refreshToken);
                entities.SaveChanges();

                return(code);
            }
        }