Class TokenSecurityRealm.Builder
- java.lang.Object
-
- org.wildfly.security.auth.realm.token.TokenSecurityRealm.Builder
-
- Enclosing class:
- TokenSecurityRealm
public static class TokenSecurityRealm.Builder extends Object
-
-
Field Summary
Fields Modifier and Type Field Description private Function<Attributes,Principal>
claimToPrincipal
private String
principalClaimName
private TokenValidator
strategy
-
Constructor Summary
Constructors Modifier Constructor Description private
Builder()
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenSecurityRealm
build()
Creates aTokenSecurityRealm
instance with all the given configuration.TokenSecurityRealm.Builder
claimToPrincipal(Function<Attributes,Principal> func)
A function that maps the set of token claims to a Principal.TokenSecurityRealm.Builder
principalClaimName(String name)
The name of the claim that should be used to obtain the principal's name.TokenSecurityRealm.Builder
validator(TokenValidator strategy)
Defines aTokenValidator
that will be used to validate tokens.
-
-
-
Field Detail
-
principalClaimName
private String principalClaimName
-
claimToPrincipal
private Function<Attributes,Principal> claimToPrincipal
-
strategy
private TokenValidator strategy
-
-
Method Detail
-
principalClaimName
public TokenSecurityRealm.Builder principalClaimName(String name)
The name of the claim that should be used to obtain the principal's name.- Parameters:
name
- the name of the claim that should be used to obtain the principal's name. Defaults tousername
- Returns:
- this instance
-
claimToPrincipal
public TokenSecurityRealm.Builder claimToPrincipal(Function<Attributes,Principal> func)
A function that maps the set of token claims to a Principal. If not specified, a function that takes the principalClaimName claim value and wraps in in a NamePrincipal is used.- Parameters:
func
- - the claim set to Principal mapping function.- Returns:
- the token Principal.
-
validator
public TokenSecurityRealm.Builder validator(TokenValidator strategy)
Defines aTokenValidator
that will be used to validate tokens.- Returns:
- this instance
-
build
public TokenSecurityRealm build()
Creates aTokenSecurityRealm
instance with all the given configuration.- Returns:
- a new
TokenSecurityRealm
instance with all the given configuration
-
-