Package org.wildfly.security.auth.realm
Class LegacyPropertiesSecurityRealm.Builder
- java.lang.Object
-
- org.wildfly.security.auth.realm.LegacyPropertiesSecurityRealm.Builder
-
- Enclosing class:
- LegacyPropertiesSecurityRealm
public static class LegacyPropertiesSecurityRealm.Builder extends Object
A builder for legacy properties security realms.
-
-
Field Summary
Fields Modifier and Type Field Description private String
defaultRealm
private String
groupsAttribute
private InputStream
groupsStream
private Charset
hashCharset
private Encoding
hashEncoding
private boolean
plainText
private Supplier<Provider[]>
providers
private InputStream
usersStream
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LegacyPropertiesSecurityRealm
build()
Builds theLegacyPropertiesSecurityRealm
.LegacyPropertiesSecurityRealm.Builder
setDefaultRealm(String defaultRealm)
Set the default realm name to use if no realm name is discovered in the properties file.LegacyPropertiesSecurityRealm.Builder
setGroupsAttribute(String groupsAttribute)
Where this realm returns anAuthorizationIdentity
set the key on the Attributes that will be used to hold the group membership information.LegacyPropertiesSecurityRealm.Builder
setGroupsStream(InputStream groupsStream)
Set theInputStream
to use to load the group information.LegacyPropertiesSecurityRealm.Builder
setHashCharset(Charset hashCharset)
Set the character set to use when converting the password string to a byte array.LegacyPropertiesSecurityRealm.Builder
setHashEncoding(Encoding hashEncoding)
Set the string format for the password in the properties file if they are not stored in plain text.LegacyPropertiesSecurityRealm.Builder
setPlainText(boolean plainText)
Set format of users property file - if the passwords are stored in plain text.LegacyPropertiesSecurityRealm.Builder
setProviders(Supplier<Provider[]> providers)
Set the supplier forProvider
instanced for use bu the realm.LegacyPropertiesSecurityRealm.Builder
setUsersStream(InputStream usersStream)
Set theInputStream
to use to load the users.
-
-
-
Field Detail
-
usersStream
private InputStream usersStream
-
groupsStream
private InputStream groupsStream
-
defaultRealm
private String defaultRealm
-
plainText
private boolean plainText
-
groupsAttribute
private String groupsAttribute
-
hashEncoding
private Encoding hashEncoding
-
hashCharset
private Charset hashCharset
-
-
Method Detail
-
setProviders
public LegacyPropertiesSecurityRealm.Builder setProviders(Supplier<Provider[]> providers)
Set the supplier forProvider
instanced for use bu the realm.- Parameters:
providers
- the supplier forProvider
instanced for use bu the realm.- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setUsersStream
public LegacyPropertiesSecurityRealm.Builder setUsersStream(InputStream usersStream)
Set theInputStream
to use to load the users.- Parameters:
usersStream
- theInputStream
to use to load the users.- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setGroupsStream
public LegacyPropertiesSecurityRealm.Builder setGroupsStream(InputStream groupsStream)
Set theInputStream
to use to load the group information.- Parameters:
groupsStream
- theInputStream
to use to load the group information.- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setGroupsAttribute
public LegacyPropertiesSecurityRealm.Builder setGroupsAttribute(String groupsAttribute)
Where this realm returns anAuthorizationIdentity
set the key on the Attributes that will be used to hold the group membership information.- Parameters:
groupsAttribute
- the key on the Attributes that will be used to hold the group membership information.- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setDefaultRealm
public LegacyPropertiesSecurityRealm.Builder setDefaultRealm(String defaultRealm)
Set the default realm name to use if no realm name is discovered in the properties file.- Parameters:
defaultRealm
- the default realm name if one is not discovered in the properties file.- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setPlainText
public LegacyPropertiesSecurityRealm.Builder setPlainText(boolean plainText)
Set format of users property file - if the passwords are stored in plain text. Otherwise is HEX( MD5( username ":" realm ":" password ) ) expected.- Parameters:
plainText
- if the passwords are stored in plain text.- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setHashEncoding
public LegacyPropertiesSecurityRealm.Builder setHashEncoding(Encoding hashEncoding)
Set the string format for the password in the properties file if they are not stored in plain text. Set to hex by default.- Parameters:
hashEncoding
- specifies the string format for the hashed password- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setHashCharset
public LegacyPropertiesSecurityRealm.Builder setHashCharset(Charset hashCharset)
Set the character set to use when converting the password string to a byte array. Set to UTF-8 by default.- Parameters:
hashCharset
- the name of the character set (must not benull
)- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
build
public LegacyPropertiesSecurityRealm build() throws IOException
Builds theLegacyPropertiesSecurityRealm
.- Returns:
- built
LegacyPropertiesSecurityRealm
- Throws:
IOException
- when loading of property files failsFileNotFoundException
- when property file does not existRealmUnavailableException
- when property file of users does not contain realm name specification
-
-