Package com.google.gerrit.server.mail
Class SignedTokenEmailTokenVerifier
- java.lang.Object
-
- com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier
-
- All Implemented Interfaces:
EmailTokenVerifier
public class SignedTokenEmailTokenVerifier extends Object implements EmailTokenVerifier
Verifies the token sent byRegisterNewEmailSender
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SignedTokenEmailTokenVerifier.Module
-
Nested classes/interfaces inherited from interface com.google.gerrit.server.mail.EmailTokenVerifier
EmailTokenVerifier.InvalidTokenException, EmailTokenVerifier.ParsedToken
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EmailTokenVerifier.ParsedToken
decode(String tokenString)
Decode a token previously created.String
encode(Account.Id accountId, String emailAddress)
Construct a token to verify an email address for a user.
-
-
-
Method Detail
-
encode
public String encode(Account.Id accountId, String emailAddress)
Description copied from interface:EmailTokenVerifier
Construct a token to verify an email address for a user.- Specified by:
encode
in interfaceEmailTokenVerifier
- Parameters:
accountId
- the caller that wants to add an email to their account.emailAddress
- the address to add.- Returns:
- an unforgeable string to email to
emailAddress
. Presenting the string provides proof the user has the ability to read messages sent to that address. Must not be null.
-
decode
public EmailTokenVerifier.ParsedToken decode(String tokenString) throws EmailTokenVerifier.InvalidTokenException
Description copied from interface:EmailTokenVerifier
Decode a token previously created.- Specified by:
decode
in interfaceEmailTokenVerifier
- Parameters:
tokenString
- the string created by encode. Never null.- Returns:
- a pair of account id and email address.
- Throws:
EmailTokenVerifier.InvalidTokenException
- the token is invalid, expired, malformed, etc.
-
-