silentpartnersoftware / Keycloak.Net

C# client for Keycloak version 17+
MIT License
51 stars 31 forks source link

Unable to create client scope #27

Closed anne376 closed 11 months ago

anne376 commented 11 months ago

I'm trying to create a client scope. The call is successful, but the UI of Keycloak throws an error when I want to display my new client scope. Error message in UI: "Danger alert:n is undefined Press here to refresh and continue"

It is noticeable that openid-connect value in protocol is displayed incorrectly. For all other items "OpenID Connect" is display, but for my new client scope "openid-connect" is displayed.

The question now is whether I am executing the call incorrectly or whether there is possibly an error. Has anyone else already had this problem?

Here is my code to create the client scope:

List<ProtocolMapper> protocolMappers = [];
ProtocolMapper mapper = new() { Name = myName, Protocol =  "opernid-connect", _ProtocolMapper = "oidc-hardcoded-claim-mapper", ConsentRequired = false };
Dictionary<string, string> mapperConfig = new()
{
                { "access.token.claim", "true" },
                { "claim.name", myName},
                { "claim.value", myId},
                { "id.token.claim", "true"},
                { "userinfo.token.claim", "true"},
                { "access.tokenResponse.claim", "false"}
};

mapper.Config = mapperConfig;
protocolMappers.Add(mapper);

clientScope = new()
{
                Name = newName,
                Protocol =  "opernid-connect",
                ProtocolMappers = protocolMappers,
};

await KeycloakClient.CreateClientScopeAsync(Realm, clientScope, cancellationToken);
anne376 commented 11 months ago

Issue can be closed. I found my mistake: Protocol = "opernid-connect" has an r that has crept in