Package io.stargate.auth
Class ImmutableAuthenticationSubject.Builder
- java.lang.Object
-
- io.stargate.auth.ImmutableAuthenticationSubject.Builder
-
- Enclosing class:
- ImmutableAuthenticationSubject
@NotThreadSafe public static final class ImmutableAuthenticationSubject.Builder extends Object
Builds instances of typeImmutableAuthenticationSubject. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableAuthenticationSubjectbuild()Builds a newImmutableAuthenticationSubject.ImmutableAuthenticationSubject.BuildercustomProperties(Map<String,String> customProperties)Initializes the value for thecustomPropertiesattribute.ImmutableAuthenticationSubject.Builderfrom(AuthenticationSubject instance)Fill a builder with attribute values from the providedAuthenticationSubjectinstance.ImmutableAuthenticationSubject.BuilderisFromExternalAuth(boolean isFromExternalAuth)Initializes the value for theisFromExternalAuthattribute.ImmutableAuthenticationSubject.BuilderroleName(String roleName)Initializes the value for theroleNameattribute.ImmutableAuthenticationSubject.Buildertoken(String token)Initializes the value for thetokenattribute.
-
-
-
Method Detail
-
from
public final ImmutableAuthenticationSubject.Builder from(AuthenticationSubject instance)
Fill a builder with attribute values from the providedAuthenticationSubjectinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
token
public final ImmutableAuthenticationSubject.Builder token(@Nullable String token)
Initializes the value for thetokenattribute.- Parameters:
token- The value for token (can benull)- Returns:
thisbuilder for use in a chained invocation
-
roleName
public final ImmutableAuthenticationSubject.Builder roleName(String roleName)
Initializes the value for theroleNameattribute.- Parameters:
roleName- The value for roleName- Returns:
thisbuilder for use in a chained invocation
-
isFromExternalAuth
public final ImmutableAuthenticationSubject.Builder isFromExternalAuth(boolean isFromExternalAuth)
Initializes the value for theisFromExternalAuthattribute.- Parameters:
isFromExternalAuth- The value for isFromExternalAuth- Returns:
thisbuilder for use in a chained invocation
-
customProperties
public final ImmutableAuthenticationSubject.Builder customProperties(Map<String,String> customProperties)
Initializes the value for thecustomPropertiesattribute.- Parameters:
customProperties- The value for customProperties- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableAuthenticationSubject build()
Builds a newImmutableAuthenticationSubject.- Returns:
- An immutable instance of AuthenticationSubject
- Throws:
IllegalStateException- if any required attributes are missing
-
-