Interface UserIdentity
- All Known Subinterfaces:
CommunicationMessage, Request, Response
- All Known Implementing Classes:
AbstractCommunicationMessage, BroadcastUserMessage, ExternalMessage, ExternalRequestMessage, RequestMessage, ResponseMessage, SendMessage, UserRequestMessage, UserResponseMessage
public interface UserIdentity
Contract for messages that carry user identity and authentication state.
Provides accessors for the user id and a verification flag, along with convenience methods for copying identity between messages and binding an authenticated user.
- Since:
- 25.1
- Author:
- 渔民小镇
- date:
- 2025-09-17
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidbindingUserId(long userId) Bind the given user id and mark the identity as verified.longGet the user id.booleanCheck whether the user's identity has been verified (authenticated).voidsetUserId(long userId) Set the user id.default voidsetUserIdentity(UserIdentity userIdentity) Copy the user id and verification flag from the given identity.voidsetVerifyIdentity(boolean verifyIdentity) Set the identity verification flag.default byteReturn the verification state as a byte (1 for verified, 0 for unverified).
-
Method Details
-
getUserId
long getUserId()Get the user id.- Returns:
- the user id
-
setUserId
void setUserId(long userId) Set the user id.- Parameters:
userId- the user id
-
isVerifyIdentity
boolean isVerifyIdentity()Check whether the user's identity has been verified (authenticated).- Returns:
trueif the identity is verified
-
setVerifyIdentity
void setVerifyIdentity(boolean verifyIdentity) Set the identity verification flag.- Parameters:
verifyIdentity-trueif the identity is verified
-
verifyIdentity
default byte verifyIdentity()Return the verification state as a byte (1 for verified, 0 for unverified).- Returns:
1if verified,0otherwise
-
setUserIdentity
Copy the user id and verification flag from the given identity.- Parameters:
userIdentity- the source identity to copy from
-
bindingUserId
default void bindingUserId(long userId) Bind the given user id and mark the identity as verified.- Parameters:
userId- the user id to bind
-