italia / spid-cie-oidc-java

The SPID/CIE OIDC Federation Relying Party, written in Java
Apache License 2.0
21 stars 4 forks source link

how to add a spid attribute to the example application? #20

Closed frhack closed 1 year ago

frhack commented 1 year ago

What is the way to add a spid attribute (like mobileNumber for example) to the example application?

mmariuzzo commented 1 year ago

Example application is a "wrapper" around the real kit. A pseudo library usable into Spring, Osgi or plain java projects. The example dosn't cover all the kit possibility.

Into RelyingPartyWrapper.postConstruct method a RelyingPartyOptions is created and used to initialize a RelyingPartyHandler.

You could use

options.addRequestedClaim(OIDCProfile.SPID, ClaimSection.USER_INFO, SPIDClaimItem.MOBILE_PHONE, false)

to add a new value. But if you use this method you have to add all the claims you want. RelyingPartyOptions.validateRequestedClaims adds the default ones only when no one is present.

To summarize:

frhack commented 1 year ago

thanks, my first attempt indeed was to change the default settings in RelyingPartyOptions but I was forgetting to rebuild the starter-kit for the changes to take effect:

cd spid-cie-oidc-java

./mvnw clean install