File tree Expand file tree Collapse file tree
Applications/Backend/Source/HttpsRichardy.Federation.WebApi/Extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,21 +34,27 @@ public static async Task UseBootstrapperAsync(this IApplicationBuilder builder)
3434 return ;
3535 }
3636
37+ await realmCollection . InsertAsync ( defaultRealm ) ;
38+
39+ realms = await realmCollection . GetRealmsAsync ( realmFilters , cancellation : default ) ;
40+ defaultRealm = realms . FirstOrDefault ( ) ?? throw new InvalidOperationException ( "Unable to load the default realm after creation." ) ;
41+
3742 defaultRealm . Permissions = [ .. RealmPermissions . SystemPermissions . Select ( permissionName => new Permission
3843 {
3944 Id = Identifier . Generate < Permission > ( ) ,
4045 Name = permissionName ,
4146 RealmId = defaultRealm . Id
4247 } ) ] ;
4348
44- defaultClient . Secret = await passwordHasher . HashPasswordAsync ( clientCredentials . ClientId + defaultClient . Name ) ;
49+ defaultClient . ClientId = clientCredentials . ClientId ;
50+ defaultClient . RealmId = defaultRealm . Id ;
51+ defaultClient . Secret = clientCredentials . ClientSecret ;
4552 defaultClient . Permissions = [ .. defaultRealm . Permissions ] ;
4653
4754 defaultRealm . Clients = [ defaultClient ] ;
4855
4956 realmProvider . SetRealm ( defaultRealm ) ;
5057
51- await realmCollection . InsertAsync ( defaultRealm ) ;
5258 await permissionCollection . InsertManyAsync ( defaultRealm . Permissions ) ;
5359 await clientCollection . InsertAsync ( defaultClient ) ;
5460
You can’t perform that action at this time.
0 commit comments