BenjaminFavre / keycloak-apple-social-identity-provider

Apple Social Identity Provider for Keycloak
Apache License 2.0
108 stars 53 forks source link

Added middleName to class Name #4

Closed Tynamix closed 3 years ago

Tynamix commented 3 years ago

Apple added the field "middleName" to the json reponse.

After first authentication an error occured on keycloak server:

09:35:52,588 ERROR [org.keycloak.broker.oidc.OIDCIdentityProvider] (default task-1) Failed to parse userJson [{"name":{"firstName":"First","middleName":"","lastName":"Last"},"email":"some@email.de"}]: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "middleName" (class fr.benjaminfavre.provider.AppleIdentityProvider$User$Name), not marked as ignorable (2 known properties: "lastName", "firstName"]) at [Source: (String)"{"name":{"firstName":"First","middleName":"","lastName":"Last"},"email":"some@email.de"}"; line: 1, column: 44] (through reference chain: fr.benjaminfavre.provider.AppleIdentityProvider$User["name"]->fr.benjaminfavre.provider.AppleIdentityProvider$User$Name["middleName"])

It was not possible to extract firstName or lastName from the json response. With this PR all works again as expected.

P.S: I hate apple!

BenjaminFavre commented 3 years ago

Thank you ! I prefered to ignore any new field received from Apple to prevent future crashes.

Tynamix commented 3 years ago

@BenjaminFavre Yes me to. I tried to add @JsonIgnoreProperties(ignoreUnknown = true) to the classes. But it did not work. It was ignored ^^.