Browse Source

Merge pull request #4384 from abpframework/gterdem/identity-server-seed

Update identityserver client seed data
pull/4471/head
Halil İbrahim Kalkan 6 years ago
committed by GitHub
parent
commit
038d9fad86
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs

23
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/IdentityServer/IdentityServerDataSeedContributor.cs

@ -116,12 +116,13 @@ namespace MyCompanyName.MyProjectName.IdentityServer
* solution. Otherwise, you can delete this client. */ * solution. Otherwise, you can delete this client. */
await CreateClientAsync( await CreateClientAsync(
webClientId, name: webClientId,
commonScopes, scopes: commonScopes,
new[] { "hybrid" }, grantTypes: new[] {"hybrid"},
(configurationSection["MyProjectName_Web:ClientSecret"] ?? "1q2w3e*").Sha256(), secret: (configurationSection["MyProjectName_Web:ClientSecret"] ?? "1q2w3e*").Sha256(),
redirectUri: $"{webClientRootUrl}signin-oidc", redirectUri: $"{webClientRootUrl}signin-oidc",
postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc" postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc",
frontChannelLogoutUri: $"{webClientRootUrl}Account/FrontChannelLogout"
); );
} }
@ -130,10 +131,10 @@ namespace MyCompanyName.MyProjectName.IdentityServer
if (!consoleClientId.IsNullOrWhiteSpace()) if (!consoleClientId.IsNullOrWhiteSpace())
{ {
await CreateClientAsync( await CreateClientAsync(
consoleClientId, name: consoleClientId,
commonScopes, scopes: commonScopes,
new[] { "password", "client_credentials" }, grantTypes: new[] {"password", "client_credentials"},
(configurationSection["MyProjectName_App:ClientSecret"] ?? "1q2w3e*").Sha256() secret: (configurationSection["MyProjectName_App:ClientSecret"] ?? "1q2w3e*").Sha256()
); );
} }
} }
@ -145,6 +146,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer
string secret, string secret,
string redirectUri = null, string redirectUri = null,
string postLogoutRedirectUri = null, string postLogoutRedirectUri = null,
string frontChannelLogoutUri = null,
IEnumerable<string> permissions = null) IEnumerable<string> permissions = null)
{ {
var client = await _clientRepository.FindByCliendIdAsync(name); var client = await _clientRepository.FindByCliendIdAsync(name);
@ -165,7 +167,8 @@ namespace MyCompanyName.MyProjectName.IdentityServer
AccessTokenLifetime = 31536000, //365 days AccessTokenLifetime = 31536000, //365 days
AuthorizationCodeLifetime = 300, AuthorizationCodeLifetime = 300,
IdentityTokenLifetime = 300, IdentityTokenLifetime = 300,
RequireConsent = false RequireConsent = false,
FrontChannelLogoutUri = frontChannelLogoutUri
}, },
autoSave: true autoSave: true
); );

Loading…
Cancel
Save