Package io.stargate.auth
Class ImmutableAuthenticationSubject
- java.lang.Object
-
- io.stargate.auth.ImmutableAuthenticationSubject
-
- All Implemented Interfaces:
AuthenticationSubject
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableAuthenticationSubject extends Object implements AuthenticationSubject
Immutable implementation ofAuthenticationSubject.Use the builder to create immutable instances:
ImmutableAuthenticationSubject.builder(). Use the static factory method to create immutable instances:ImmutableAuthenticationSubject.of().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableAuthenticationSubject.BuilderBuilds instances of typeImmutableAuthenticationSubject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableAuthenticationSubject.Builderbuilder()Creates a builder forImmutableAuthenticationSubject.static ImmutableAuthenticationSubjectcopyOf(AuthenticationSubject instance)Creates an immutable copy of aAuthenticationSubjectvalue.Map<String,String>customProperties()booleanequals(Object another)This instance is equal to all instances ofImmutableAuthenticationSubjectthat have equal attribute values.inthashCode()Computes a hash code from attributes:token,roleName,isFromExternalAuth,customProperties.booleanisFromExternalAuth()static ImmutableAuthenticationSubjectof(String token, String roleName, boolean isFromExternalAuth, Map<String,String> customProperties)Construct a new immutableAuthenticationSubjectinstance.StringroleName()Stringtoken()StringtoString()Prints the immutable valueAuthenticationSubjectwith attribute values.ImmutableAuthenticationSubjectwithCustomProperties(Map<String,String> value)Copy the current immutable object by setting a value for thecustomPropertiesattribute.ImmutableAuthenticationSubjectwithIsFromExternalAuth(boolean value)Copy the current immutable object by setting a value for theisFromExternalAuthattribute.ImmutableAuthenticationSubjectwithRoleName(String value)Copy the current immutable object by setting a value for theroleNameattribute.ImmutableAuthenticationSubjectwithToken(String value)Copy the current immutable object by setting a value for thetokenattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.stargate.auth.AuthenticationSubject
asUser
-
-
-
-
Method Detail
-
token
@Nullable public String token()
- Specified by:
tokenin interfaceAuthenticationSubject- Returns:
- The value of the
tokenattribute
-
roleName
public String roleName()
- Specified by:
roleNamein interfaceAuthenticationSubject- Returns:
- The value of the
roleNameattribute
-
isFromExternalAuth
public boolean isFromExternalAuth()
- Specified by:
isFromExternalAuthin interfaceAuthenticationSubject- Returns:
- The value of the
isFromExternalAuthattribute
-
customProperties
public Map<String,String> customProperties()
- Specified by:
customPropertiesin interfaceAuthenticationSubject- Returns:
- The value of the
customPropertiesattribute
-
withToken
public final ImmutableAuthenticationSubject withToken(@Nullable String value)
Copy the current immutable object by setting a value for thetokenattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for token (can benull)- Returns:
- A modified copy of the
thisobject
-
withRoleName
public final ImmutableAuthenticationSubject withRoleName(String value)
Copy the current immutable object by setting a value for theroleNameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for roleName- Returns:
- A modified copy of the
thisobject
-
withIsFromExternalAuth
public final ImmutableAuthenticationSubject withIsFromExternalAuth(boolean value)
Copy the current immutable object by setting a value for theisFromExternalAuthattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for isFromExternalAuth- Returns:
- A modified copy of the
thisobject
-
withCustomProperties
public final ImmutableAuthenticationSubject withCustomProperties(Map<String,String> value)
Copy the current immutable object by setting a value for thecustomPropertiesattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for customProperties- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableAuthenticationSubjectthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:token,roleName,isFromExternalAuth,customProperties.
-
toString
public String toString()
Prints the immutable valueAuthenticationSubjectwith attribute values.
-
of
public static ImmutableAuthenticationSubject of(@Nullable String token, String roleName, boolean isFromExternalAuth, Map<String,String> customProperties)
Construct a new immutableAuthenticationSubjectinstance.- Parameters:
token- The value for thetokenattributeroleName- The value for theroleNameattributeisFromExternalAuth- The value for theisFromExternalAuthattributecustomProperties- The value for thecustomPropertiesattribute- Returns:
- An immutable AuthenticationSubject instance
-
copyOf
public static ImmutableAuthenticationSubject copyOf(AuthenticationSubject instance)
Creates an immutable copy of aAuthenticationSubjectvalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable AuthenticationSubject instance
-
builder
public static ImmutableAuthenticationSubject.Builder builder()
Creates a builder forImmutableAuthenticationSubject.ImmutableAuthenticationSubject.builder() .token(String | null) // nullabletoken.roleName(String) // requiredroleName.isFromExternalAuth(boolean) // requiredisFromExternalAuth.customProperties(Map<String, String>) // requiredcustomProperties.build();- Returns:
- A new ImmutableAuthenticationSubject builder
-
-