ozwillo / ozwillo-portal

Ozwillo's user portal
https://www.ozwillo.com
GNU Affero General Public License v3.0
1 stars 2 forks source link

Integration with FranceConnect Particuliers (FCP) #404

Open bobeal opened 7 years ago

bobeal commented 7 years ago

New features to integrate in profile page :

tbroyer commented 7 years ago

Note: the email address is verified on FCP side, and will be part of the identity (https://partenaires.franceconnect.gouv.fr/monprojet/decouverte/), so should Ozwillo just use it? In this case, we could cross out "change an email address if account has no associated password"…

tbroyer commented 7 years ago

The /d/user/{user_id} Kernel endpoint will return a new authentication_methods property with possible values pwd and franceconnect. Either one or both values can be present to tell whether the account has a password and/or is linked to a FCP identity.

To link the account with FCP and/or synchronize the profile info, the user's browser must make an HTTP POST request to the /a/franceconnect/login Kernel endpoint with application/x-www-form-urlencoded payload containing a continue key whose value is the URI to redirect to after successful authentication (possibly transparent) to FCP. The user will only be redirected to the continue URL if the authentication and/or linking succeeds. The continue URL will have to make a call (HTTP GET or POST) to the /a/franceconnect/userinfo Kernel endpoint to retrieve the FCP identity (this reverse-proxies the request to the FCP UserInfo endpoint, with the appropriate FCP access token). In case of error (could signal an expired FCP access token), the Portal should start the "FCP dance" again (HTTP POST to /a/franceconnect/login; probably user-driven from an error page, e.g. "there was an error, try again", with a button submitting the form to the Kernel). Due to FCP limitations, the Portal should probably cache the result somehow to survive page reloads and prevent those error conditions (but then clear the cache when starting the "FCP dance" to retrieve fresh informations).

To remove the FCP identity association, a simple link to /a/franceconnect/unlink on the Kernel will be enough. The Kernel will display a confirmation page and handle everything. Upon "unlinking", the Kernel will redirect to the Portal's "my profile" page, so there's no need for a "continue URL".

To set a password, the same /a/password Kernel page will be used as for changing an existing password; the page will adapt depending on whether the account already has a password or not.

Nicoletti-Seb commented 7 years ago

To synchronize the profile info with FranceConnect @tbroyer you say in your previous comment to make an HTTP POST request to /a/franceconnect/login but I found in kernel an endpoint to /a/franceconnect/link. So, to link an account to franceconnect I am not sure about url and parameters to use. Do you need this parameters (FranceConnect Particulier) in request and a continue parameter to do an redirection ?

tbroyer commented 7 years ago

/a/franceconnect/link is an "internal" endpoint used in some cases after coming back from FranceConnect. The one the Portal needs to POST to is /a/franceconnect/login (that's actually the only one in the Kernel that accepts form POST requests from the Portal: @StrictReferer(allowPortal=true); for reference, @StrictReferer triggers a check on Origin or Referer request headers to prevent CSRF, and for /a/franceconnect/login we make an exception for the Portal).

bobeal commented 6 years ago
tbroyer commented 6 years ago

Rename "France Connect" to "FranceConnect Particuliers"

I would disagree with this one. Only the developer documentation ever calls it that way; everywhere else, and for everyone, it's just FranceConnect. When FranceConnect Agent will be a thing, then I believe there will be "FranceConnect" and "FranceConnect Agent" (and for now, FranceConnect Entreprise looks as if it's anecdotal, and the two websites I know of that use it just call it “FranceConnect” too).

Your call though.

bobeal commented 6 years ago

OK, you win, let's go for FranceConnect :)

bobeal commented 6 years ago

From the profile page :

From the profile synchronization page :

error: "Bad Request"
exception: "org.springframework.http.converter.HttpMessageNotReadableException"
message: "Could not read document: Can not deserialize value of type java.time.LocalDate from String "1981,6,23": Text '1981,6,23' could not be parsed at index 4↵ at [Source: java.io.PushbackInputStream@28b29955; line: 1, column: 526] (through reference chain: org.oasis_eu.portal.model.kernel.UserProfile["birthdate"]); nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not deserialize value of type java.time.LocalDate from String "1981,6,23": Text '1981,6,23' could not be parsed at index 4↵ at [Source: java.io.PushbackInputStream@28b29955; line: 1, column: 526] (through reference chain: org.oasis_eu.portal.model.kernel.UserProfile["birthdate"])"
path: "/my/api/profile"
status: 400
timestamp: 1515487932851

screenshot from 2018-01-08 11-10-15

bobeal commented 6 years ago