Package google.registry.request.auth
Record Class AuthResult
java.lang.Object
java.lang.Record
google.registry.request.auth.AuthResult
- Record Components:
authLevel
- the level of authentication obtaineduser
- information about the authenticated user, if there is oneserviceAccountEmail
- service account email of the authenticated app, if there is one
public record AuthResult(AuthSettings.AuthLevel authLevel, Optional<User> user, Optional<String> serviceAccountEmail)
extends Record
Results of authentication for a given HTTP request, as emitted by an
AuthenticationMechanism
.-
Field Summary
-
Constructor Summary
ConstructorDescriptionAuthResult
(AuthSettings.AuthLevel authLevel, Optional<User> user, Optional<String> serviceAccountEmail) Creates an instance of aAuthResult
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theauthLevel
record component.static AuthResult
static AuthResult
createUser
(User user) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theserviceAccountEmail
record component.final String
toString()
Returns a string representation of this record class.user()
Returns the value of theuser
record component.
-
Field Details
-
NOT_AUTHENTICATED
No authentication was made.In the authentication step, this means that none of the configured authentication methods were able to authenticate the user. But the authorization settings may be such that it's perfectly fine not to be authenticated. The
RequestAuthenticator.authorize(google.registry.request.auth.AuthSettings, jakarta.servlet.http.HttpServletRequest)
method returns NOT_AUTHENTICATED in this case, as opposed to absent() if authentication failed and was required. So as a return from an authorization check, this can be treated as a success.
-
-
Constructor Details
-
AuthResult
public AuthResult(AuthSettings.AuthLevel authLevel, Optional<User> user, Optional<String> serviceAccountEmail) Creates an instance of aAuthResult
record class.- Parameters:
authLevel
- the value for theauthLevel
record componentuser
- the value for theuser
record componentserviceAccountEmail
- the value for theserviceAccountEmail
record component
-
-
Method Details
-
isAuthenticated
public boolean isAuthenticated() -
userIdForLogging
-
createApp
-
createUser
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
authLevel
Returns the value of theauthLevel
record component.- Returns:
- the value of the
authLevel
record component
-
user
Returns the value of theuser
record component.- Returns:
- the value of the
user
record component
-
serviceAccountEmail
Returns the value of theserviceAccountEmail
record component.- Returns:
- the value of the
serviceAccountEmail
record component
-