|
|
|
@ -25,130 +25,127 @@ public class ServerDataSeedContributor : IDataSeedContributor, ITransientDepende |
|
|
|
|
|
|
|
public async Task SeedAsync(DataSeedContext context) |
|
|
|
{ |
|
|
|
using (_currentTenant.Change(null)) |
|
|
|
if (await _scopeManager.FindByNameAsync("AbpAPI") == null) |
|
|
|
{ |
|
|
|
if (await _scopeManager.FindByNameAsync("AbpAPI") == null) |
|
|
|
await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor() |
|
|
|
{ |
|
|
|
await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor() |
|
|
|
Name = "AbpAPI", |
|
|
|
DisplayName = "Abp API access", |
|
|
|
DisplayNames = |
|
|
|
{ |
|
|
|
Name = "AbpAPI", |
|
|
|
DisplayName = "Abp API access", |
|
|
|
DisplayNames = |
|
|
|
{ |
|
|
|
[CultureInfo.GetCultureInfo("zh-Hans")] = "演示 API 访问", |
|
|
|
[CultureInfo.GetCultureInfo("tr")] = "API erişimi" |
|
|
|
}, |
|
|
|
Resources = |
|
|
|
{ |
|
|
|
"AbpAPIResource" |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
[CultureInfo.GetCultureInfo("zh-Hans")] = "演示 API 访问", |
|
|
|
[CultureInfo.GetCultureInfo("tr")] = "API erişimi" |
|
|
|
}, |
|
|
|
Resources = |
|
|
|
{ |
|
|
|
"AbpAPIResource" |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
if (await _applicationManager.FindByClientIdAsync("AbpApp") == null) |
|
|
|
if (await _applicationManager.FindByClientIdAsync("AbpApp") == null) |
|
|
|
{ |
|
|
|
await _applicationManager.CreateAsync(new OpenIddictApplicationDescriptor |
|
|
|
{ |
|
|
|
await _applicationManager.CreateAsync(new OpenIddictApplicationDescriptor |
|
|
|
ClientId = "AbpApp", |
|
|
|
ClientSecret = "1q2w3e*", |
|
|
|
ConsentType = OpenIddictConstants.ConsentTypes.Explicit, |
|
|
|
DisplayName = "Abp Application", |
|
|
|
PostLogoutRedirectUris = |
|
|
|
{ |
|
|
|
new Uri("https://localhost:44302/signout-callback-oidc"), |
|
|
|
new Uri("http://localhost:4200") |
|
|
|
}, |
|
|
|
RedirectUris = |
|
|
|
{ |
|
|
|
new Uri("https://localhost:44302/signin-oidc"), |
|
|
|
new Uri("http://localhost:4200") |
|
|
|
}, |
|
|
|
Permissions = |
|
|
|
{ |
|
|
|
ClientId = "AbpApp", |
|
|
|
ClientSecret = "1q2w3e*", |
|
|
|
ConsentType = OpenIddictConstants.ConsentTypes.Explicit, |
|
|
|
DisplayName = "Abp Application", |
|
|
|
PostLogoutRedirectUris = |
|
|
|
{ |
|
|
|
new Uri("https://localhost:44302/signout-callback-oidc"), |
|
|
|
new Uri("http://localhost:4200") |
|
|
|
}, |
|
|
|
RedirectUris = |
|
|
|
{ |
|
|
|
new Uri("https://localhost:44302/signin-oidc"), |
|
|
|
new Uri("http://localhost:4200") |
|
|
|
}, |
|
|
|
Permissions = |
|
|
|
{ |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Authorization, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Token, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Device, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Introspection, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Revocation, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Logout, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Authorization, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Token, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Device, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Introspection, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Revocation, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Logout, |
|
|
|
|
|
|
|
OpenIddictConstants.Permissions.GrantTypes.AuthorizationCode, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.Implicit, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.Password, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.RefreshToken, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.DeviceCode, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.ClientCredentials, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.AuthorizationCode, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.Implicit, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.Password, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.RefreshToken, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.DeviceCode, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.ClientCredentials, |
|
|
|
|
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.Code, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeIdToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeIdTokenToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.IdToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.IdTokenToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.None, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.Token, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.Code, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeIdToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeIdTokenToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.IdToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.IdTokenToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.None, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.Token, |
|
|
|
|
|
|
|
OpenIddictConstants.Permissions.Scopes.Roles, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Profile, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Email, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Address, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Phone, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Roles, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Profile, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Email, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Address, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Phone, |
|
|
|
|
|
|
|
OpenIddictConstants.Permissions.Prefixes.Scope + "AbpAPI" |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
OpenIddictConstants.Permissions.Prefixes.Scope + "AbpAPI" |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
if (await _applicationManager.FindByClientIdAsync("AbpBlazorWASMApp") == null) |
|
|
|
if (await _applicationManager.FindByClientIdAsync("AbpBlazorWASMApp") == null) |
|
|
|
{ |
|
|
|
await _applicationManager.CreateAsync(new OpenIddictApplicationDescriptor |
|
|
|
{ |
|
|
|
await _applicationManager.CreateAsync(new OpenIddictApplicationDescriptor |
|
|
|
ClientId = "AbpBlazorWASMApp", |
|
|
|
ConsentType = OpenIddictConstants.ConsentTypes.Explicit, |
|
|
|
DisplayName = "Abp Blazor WASM Application", |
|
|
|
PostLogoutRedirectUris = |
|
|
|
{ |
|
|
|
new Uri("https://localhost:44304/authentication/logout-callback") |
|
|
|
}, |
|
|
|
RedirectUris = |
|
|
|
{ |
|
|
|
new Uri("https://localhost:44304/authentication/login-callback") |
|
|
|
}, |
|
|
|
Permissions = |
|
|
|
{ |
|
|
|
ClientId = "AbpBlazorWASMApp", |
|
|
|
ConsentType = OpenIddictConstants.ConsentTypes.Explicit, |
|
|
|
DisplayName = "Abp Blazor WASM Application", |
|
|
|
PostLogoutRedirectUris = |
|
|
|
{ |
|
|
|
new Uri("https://localhost:44304/authentication/logout-callback") |
|
|
|
}, |
|
|
|
RedirectUris = |
|
|
|
{ |
|
|
|
new Uri("https://localhost:44304/authentication/login-callback") |
|
|
|
}, |
|
|
|
Permissions = |
|
|
|
{ |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Authorization, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Token, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Device, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Introspection, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Revocation, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Logout, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Authorization, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Token, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Device, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Introspection, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Revocation, |
|
|
|
OpenIddictConstants.Permissions.Endpoints.Logout, |
|
|
|
|
|
|
|
OpenIddictConstants.Permissions.GrantTypes.AuthorizationCode, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.Implicit, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.Password, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.RefreshToken, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.DeviceCode, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.ClientCredentials, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.AuthorizationCode, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.Implicit, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.Password, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.RefreshToken, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.DeviceCode, |
|
|
|
OpenIddictConstants.Permissions.GrantTypes.ClientCredentials, |
|
|
|
|
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.Code, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeIdToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeIdTokenToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.IdToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.IdTokenToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.None, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.Token, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.Code, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeIdToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeIdTokenToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.CodeToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.IdToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.IdTokenToken, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.None, |
|
|
|
OpenIddictConstants.Permissions.ResponseTypes.Token, |
|
|
|
|
|
|
|
OpenIddictConstants.Permissions.Scopes.Roles, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Profile, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Email, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Address, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Phone, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Roles, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Profile, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Email, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Address, |
|
|
|
OpenIddictConstants.Permissions.Scopes.Phone, |
|
|
|
|
|
|
|
OpenIddictConstants.Permissions.Prefixes.Scope + "AbpAPI" |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
OpenIddictConstants.Permissions.Prefixes.Scope + "AbpAPI" |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|