-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support changes to the resource paths in Keycloak 18.0+. Resolves #695.
- Loading branch information
1 parent
5d8cabb
commit 34e7b72
Showing
5 changed files
with
70 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,19 +52,39 @@ static void ConfigureServices(IServiceCollection services) | |
} | ||
|
||
[Theory] | ||
[InlineData(ClaimTypes.NameIdentifier, "995c1500-0dca-495e-ba72-2499d370d181")] | ||
[InlineData(ClaimTypes.Email, "[email protected]")] | ||
[InlineData(ClaimTypes.GivenName, "John")] | ||
[InlineData(ClaimTypes.Role, "admin")] | ||
[InlineData(ClaimTypes.Name, "John Smith")] | ||
public async Task Can_Sign_In_Using_Keycloak_Domain(string claimType, string claimValue) | ||
[InlineData(null, ClaimTypes.NameIdentifier, "995c1500-0dca-495e-ba72-2499d370d181")] | ||
[InlineData(null, ClaimTypes.Email, "[email protected]")] | ||
[InlineData(null, ClaimTypes.GivenName, "John")] | ||
[InlineData(null, ClaimTypes.Role, "admin")] | ||
[InlineData(null, ClaimTypes.Name, "John Smith")] | ||
[InlineData("17.0", ClaimTypes.NameIdentifier, "995c1500-0dca-495e-ba72-2499d370d181")] | ||
[InlineData("17.0", ClaimTypes.Email, "[email protected]")] | ||
[InlineData("17.0", ClaimTypes.GivenName, "John")] | ||
[InlineData("17.0", ClaimTypes.Role, "admin")] | ||
[InlineData("17.0", ClaimTypes.Name, "John Smith")] | ||
[InlineData("18.0", ClaimTypes.NameIdentifier, "995c1500-0dca-495e-ba72-2499d370d181")] | ||
[InlineData("18.0", ClaimTypes.Email, "[email protected]")] | ||
[InlineData("18.0", ClaimTypes.GivenName, "John")] | ||
[InlineData("18.0", ClaimTypes.Role, "admin")] | ||
[InlineData("18.0", ClaimTypes.Name, "John Smith")] | ||
[InlineData("19.0", ClaimTypes.NameIdentifier, "995c1500-0dca-495e-ba72-2499d370d181")] | ||
[InlineData("19.0", ClaimTypes.Email, "[email protected]")] | ||
[InlineData("19.0", ClaimTypes.GivenName, "John")] | ||
[InlineData("19.0", ClaimTypes.Role, "admin")] | ||
[InlineData("19.0", ClaimTypes.Name, "John Smith")] | ||
public async Task Can_Sign_In_Using_Keycloak_Domain(string? version, string claimType, string claimValue) | ||
{ | ||
// Arrange | ||
static void ConfigureServices(IServiceCollection services) | ||
void ConfigureServices(IServiceCollection services) | ||
{ | ||
services.PostConfigureAll<KeycloakAuthenticationOptions>((options) => | ||
{ | ||
options.Domain = "keycloak.local"; | ||
if (version is not null) | ||
{ | ||
options.Version = Version.Parse(version); | ||
} | ||
}); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,29 @@ | |
"email": "[email protected]" | ||
} | ||
}, | ||
{ | ||
"uri": "https://keycloak.local/realms/myrealm/protocol/openid-connect/token", | ||
"method": "POST", | ||
"contentFormat": "json", | ||
"contentJson": { | ||
"access_token": "79d687a0ea4910c6662b2e38116528fdcd65f0d1", | ||
"expires_in": 3600, | ||
"token_type": "Bearer", | ||
"scope": "openid", | ||
"refresh_token": "c1de730eef1b2072b48799000ec7cde4ea6d2af0" | ||
} | ||
}, | ||
{ | ||
"uri": "https://keycloak.local/realms/myrealm/protocol/openid-connect/userinfo", | ||
"contentFormat": "json", | ||
"contentJson": { | ||
"sub": "995c1500-0dca-495e-ba72-2499d370d181", | ||
"roles": "admin", | ||
"name": "John Smith", | ||
"given_name": "John", | ||
"email": "[email protected]" | ||
} | ||
}, | ||
{ | ||
"uri": "http://localhost:8080/auth/realms/myrealm/protocol/openid-connect/token", | ||
"method": "POST", | ||
|