public static UserModel ToModel(this UserData userData, IdentityServerCryptography cryptography) { if (userData == null) { return(UserModel.Empty); } var password = cryptography.Decrypt(userData.Password); return(new UserModel(userData.Id, userData.Name, userData.Email, password, userData.IsActive, userData.Roles)); }
public static ClientModel ToModel(this ClientData data, IdentityServerCryptography cryptography) { var model = new ClientModel(); if (data != null) { model = new ClientModel(data.Id, cryptography.Decrypt(data.ClientSecret)) { ClientId = data.ClientId, ClientSecrets = { new Secret(cryptography.Decrypt(data.ClientSecret).Sha256()) }, AllowedGrantTypes = data.AllowedGrantTypes.ToList(), AllowedScopes = data.AllowedScopes.ToList(), PostLogoutRedirectUris = { data.PostLogoutRedirectUrl }, RedirectUris = { data.RedirectUrl }, Enabled = data.Enabled, Description = data.Description, ClientName = data.ClientName }; } return(model); }
public static ClientData ToData(this ClientInputModel inputModel, IdentityServerCryptography cryptography) { var data = new ClientData(); if (inputModel != null) { data = new ClientData() { Id = inputModel.Id, ClientId = inputModel.ClientId, ClientSecret = cryptography.Encrypt(inputModel.ClientSecret), AllowedGrantTypes = inputModel.AllowedGrantTypes, AllowedScopes = inputModel.AllowedScopes, RedirectUrl = inputModel.RedirectUrl, PostLogoutRedirectUrl = inputModel.PostLogoutRedirectUrl, ClientName = inputModel.ClientName, Description = inputModel.Description }; } return(data); }
public ClientService(IClientDataAccess clientDataAccess, IdentityServerCryptography cryptography) { ClientDataAccess = clientDataAccess; Cryptography = cryptography; }
public AccountService(IUserDataAccess userDataAccess, IdentityServerCryptography cryptography) { this.UserDataAccess = userDataAccess ?? throw new System.ArgumentNullException(nameof(userDataAccess)); this.Cryptography = cryptography ?? throw new System.ArgumentNullException(nameof(cryptography)); }
public static UserData ToData(this UserInputModel userInputModel, IdentityServerCryptography cryptography) { var password = cryptography.Encrypt(userInputModel.Password); return(new UserData(userInputModel.Id, userInputModel.Name, userInputModel.Email, password, userInputModel.Roles)); }
public UserService(IUserDataAccess userDataAccess, IdentityServerCryptography identityServerCryptography) { UserDataAccess = userDataAccess ?? throw new ArgumentNullException(nameof(userDataAccess)); IdentityServerCryptography = identityServerCryptography ?? throw new ArgumentNullException(nameof(identityServerCryptography)); }