Package org.jwcarman.who.emaillink
package org.jwcarman.who.emaillink
-
ClassDescriptionThe answer of
POST /who/me/email-addresses/confirmations.An email telling an address that it no longer signs in, because the identity's owner (or someone with their session) made another address theirs in its place.Adds an email address to a signed-in identity, or makes one theirs in place of another, only once the person confirms a link or code sent to it.A typed confirmation code counted against a request: the request and the code hash to compare the typed code with.An email asking the person to confirm an address they asked to add to their identity, or to make their address in place of another: the link and the typed code that both confirm it.A signed-in identity asked atPOST /who/me/email-addressesto add an email address, or to make one theirs in place of another, published once per request with what became of it.POST /who/me/email-addressesasks to add an address, or to change one (replaces), andPOST /who/me/email-addresses/confirmationsconfirms it with the link's token or the code.A signed-in person's request to add an email address to their identity, or to make it theirs in place of another, waiting for them to confirm the link or code sent to it.What became of a request to add or change an email address.Stores the requests to add or change an email address, one per identity.Thrown when an email address is already registered.One of the caller's email addresses, asGET /who/me/email-addresseslists it.A counted attempt at a sign-in code: the credential it belongs to and the stored code hash to compare the submitted code against.Hashes sign-in codes with a keyed HMAC-SHA256, bound to the credential they were issued for.Credential representing an email address linked to an identity.A request named an email address to replace that is not one of the caller's own.Storage forEmailCredentials.Registers and revokes email credentials, publishingCredentialAddedandCredentialRevokedfor each change.Authenticates an email sign-in, by the token from the link or by the address and the code typed by hand, then resolves its email credential to an active identity.AnswersPOST /who/email/sendwith202at once and hands the real work toEmailLinkIssueron another thread, so the response time does not reveal whether the address is known.Does the real work behindPOST /who/email/send, off the request thread: looks up the address, stores the token's hash (the upsert that is also the resend limit), and sends the link.Email-link sign-in through Spring Security'soneTimeTokenLogin(), underwho.base-path(POST /who/email/send,POST /who/email/sign-inby default), with who's hooks and no default pages.A sign-in email to deliver: the link and the typed code that both complete the same sign-in.WhatEmailLinkIssuer.issue(String, String)did with a request.Settings for email sign-in links.Storage for sign-in link tokens.An unauthenticated email sign-in request carrying itsEmailSignInProof, as read byJsonOneTimeTokenAuthenticationConverterand authenticated byEmailLinkAuthenticationProvider.Counts an identity's email addresses, for the last-credential rule.What a sign-in request atPOST /who/email/sign-inpresents: the token from the emailed link, the address and code typed by hand, or something malformed.An address and the code from the email, both exactly as typed.The token from the emailed link.A request that is neither a link token nor an address and code.An identity was invited byInvitationService.invite(String, Set).A confirmation atPOST /who/me/email-addresses/confirmationsmatched nothing: no request by this identity, an expired or used one, a wrong code, or a code with no attempts left.An invitation who refuses as asked, before anything is created or with everything rolled back: the address is missing or is not an address, a role name is blank or names no role, or roles were asked for in an application withoutwho-rbac.WhatInvitationService.invite(String, Set)did: the identity it created, which stands whatever became of the link, and what became of the sign-in link sent to it.An email inviting a person to the application: the link and the typed code that both sign them in with the invited address, which is accepting the invitation.Gives an invited identity its roles, forInvitationService.Invites a person by email address: creates an identity for them, signs it in with that address, gives it roles, and sends it a sign-in link in anInvitationMessage.JDBC implementation ofEmailAddressRequestRepositoryonwho_email_address_request.JDBC implementation ofEmailCredentialRepositoryonwho_email_credential.JDBC implementation ofEmailLinkTokenRepositoryonwho_email_link_token.Reads{"email": "..."}from the body ofPOST /who/email/send.Reads the body ofPOST /who/email/sign-in: either{"token": "..."}from the emailed link, or{"email": "...", "code": "..."}typed by hand.TheInvitationRolesofwho-rbac: assigns each role by name withRbacService.assignRoleByName(Identity, String).A sign-in email was requested atPOST /who/email/send, published once per request byEmailLinkIssuer.issue(String, String)with what became of it.Spring SecurityOneTimeTokenServicefor email links.