-
Notifications
You must be signed in to change notification settings - Fork 977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow skipping verification of addresses already verified by OIDC providers #3424
Comments
I like this rfc @Saancreed a lot I think this is more flexible than a claim check (like I proposed in the past #1057 (comment)). We do however need to help users make sure the email can be trusted.
|
Thanks! I've seen your suggestion and addressed it "Alternatives considered" section. It would indeed be simpler to configure like this but it makes a bit too many implicit assumptions for my tastes which I'm afraid wouldn't be very clear to the users. And while Kratos will attach
I have to admit, the only providers I had in mind while designing this were Google and Apple and those cases are already covered with no additional work required. But to address some other providers you mentioned:
Kratos seems to go with the former.
Actually, so does Facebook! Kratos already does additional calls for some providers before executing Jsonnet mappers, e.g. provider for Facebook retrieves claims using a separate HTTP call to Facebook's Graph API. But in any case, that would be some additional provider-specific code which could (should?) be handled separately from this feature and implemented in another PR. |
Agreed it's a good design, lets try to get some input from ory people. |
Great stuff, this makes a lot of sense IMO. I think we could put the
|
Sure, that would also work (except your code is currently the same as mine). I assumed having this returned "separately" would be better because of the distinction that values under |
I realized that the hierarchy in this jsonnet is not correct. As I see it in the following code, the Consequently, your jsonnet would turn out to be the following: local claims = {
email_verified: false,
} + std.extVar('claims');
{
identity: {
traits: {
[if 'email' in claims && claims.email_verified then 'email' else null]: claims.email,
given_name: claims.given_name,
family_name: claims.family_name,
},
verified_addresses: std.prune([
if 'email' in claims && claims.email_verified then { via: 'email', value: claims.email },
]),
},
} |
Preflight checklist
Ory Network Project
No response
Context and scope
In (fairly common) scenarios in which Kratos is configured to allow registration using both password and OIDC methods, identity schema contains a verifiable address (often email) and having a verified address is required to sign in with password, the inability to mark an address as verified during OIDC registration leads to several pain points:
See related issue: #1057
The plan is to allow Kratos administrator to configure which addresses are trusted to be already verified for each known OIDC provider.
Goals and non-goals
Goals:
Non-goals:
The design
We allow Jsonnet mapper to produce additional result returned via
verified_addresses
key. If present, it should be an array of objects each with twostring
properties:via
describing the type of an address (corresponding directly toVerifiableAddressType
) andvalue
being the value of the address itself (phone number or email). After the identity is created and passes validation, any verifiable address matching one of addresses inverified_addresses
is automatically marked as verified and no verification flow is started.To simplify comparison of email addresses without complicating Jsonnet snippets, any
value
in an object withvia
equal to"email"
is normalized by trimming spaces and converting to lower case after evaluating the snippet but before performing the compariton itself, matching normalization rules of verifiable addresses withemail
type.APIs
Client APIs are unaffected, the only contract that changes is the extension of result returned by Jsonnet OIDC claim mappers.
Data storage
No response
Code and pseudo-code
A sample work-in-progress implementation can be found here: https://github.com/leancodepl/kratos/tree/feat/oidc-preverified-addresses
Then, an example Jsonnet snippet taking advantage of this feature could look like this:
Degree of constraint
No response
Alternatives considered
kratos.yaml
config file, but expressing similar logic in YAML could be clunky while simplifying the feature to "here, look if this, let's say,email_verified
claim istrue
" makes it less obvious which email will be considered trusted and what will happen if user modified their traits before completing registration while also being less extensible.The text was updated successfully, but these errors were encountered: