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 }); }
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; } }
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); } }