Package google.registry.request.auth
Record Class AuthResult
java.lang.Object
java.lang.Record
google.registry.request.auth.AuthResult
- Record Components:
userAuthInfo
- Information about the authenticated user, if there is one.appServiceAccount
- Service account email of the authenticated app, if there is one. This will be logged upon successful login.
public record AuthResult(AuthSettings.AuthLevel authLevel, Optional<UserAuthInfo> userAuthInfo, Optional<String> appServiceAccount)
extends Record
Results of authentication for a given HTTP request, as emitted by an
AuthenticationMechanism
.-
Field Summary
-
Constructor Summary
ConstructorDescriptionAuthResult
(AuthSettings.AuthLevel authLevel, Optional<UserAuthInfo> userAuthInfo, Optional<String> appServiceAccount) Creates an instance of aAuthResult
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theappServiceAccount
record component.Returns the value of theauthLevel
record component.static AuthResult
static AuthResult
createUser
(UserAuthInfo userAuthInfo) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
final String
toString()
Returns a string representation of this record class.Returns the value of theuserAuthInfo
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<UserAuthInfo> userAuthInfo, Optional<String> appServiceAccount) Creates an instance of aAuthResult
record class.- Parameters:
authLevel
- the value for theauthLevel
record componentuserAuthInfo
- the value for theuserAuthInfo
record componentappServiceAccount
- the value for theappServiceAccount
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
-
userAuthInfo
Returns the value of theuserAuthInfo
record component.- Returns:
- the value of the
userAuthInfo
record component
-
appServiceAccount
Returns the value of theappServiceAccount
record component.- Returns:
- the value of the
appServiceAccount
record component
-