ch4mpy / spring-addons

Ease spring OAuth2 resource-servers configuration and testing
Apache License 2.0
530 stars 87 forks source link

Property on `@OpenIdClaims` to define all claims with a JSON string #127

Closed ch4mpy closed 1 year ago

ch4mpy commented 1 year ago

Is your feature request related to a problem? Please describe. Currently, I have to go down otherClaims to define claims with a JSON string (with @JsonObjectClaim), even if I want to define standard claims.

@OpenId(
    authorities = { "NICE", "AUTHOR" },
    claims = @OpenIdClaims(
        usernameClaim = "$['https://c4-soft.com/user']['name']", 
        otherClaims = @Claims(
            jsonObjectClaims = @JsonObjectClaim(name = "https://c4-soft.com/user", value = "{\"name\": \"Ch4mp\"}"))))

Describe the solution you'd like

@OpenId(
    authorities = { "NICE", "AUTHOR" },
    claims = @OpenIdClaims(
        usernameClaim = "$['https://c4-soft.com/user']['name']", 
        json = @JsonObjectClaim(name = "https://c4-soft.com/user", value = "{\"name\": \"Ch4mp\"}"))))