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 StringdefaultRealmprivate StringgroupsAttributeprivate InputStreamgroupsStreamprivate CharsethashCharsetprivate EncodinghashEncodingprivate booleanplainTextprivate Supplier<Provider[]>providersprivate InputStreamusersStream
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LegacyPropertiesSecurityRealmbuild()Builds theLegacyPropertiesSecurityRealm.LegacyPropertiesSecurityRealm.BuildersetDefaultRealm(String defaultRealm)Set the default realm name to use if no realm name is discovered in the properties file.LegacyPropertiesSecurityRealm.BuildersetGroupsAttribute(String groupsAttribute)Where this realm returns anAuthorizationIdentityset the key on the Attributes that will be used to hold the group membership information.LegacyPropertiesSecurityRealm.BuildersetGroupsStream(InputStream groupsStream)Set theInputStreamto use to load the group information.LegacyPropertiesSecurityRealm.BuildersetHashCharset(Charset hashCharset)Set the character set to use when converting the password string to a byte array.LegacyPropertiesSecurityRealm.BuildersetHashEncoding(Encoding hashEncoding)Set the string format for the password in the properties file if they are not stored in plain text.LegacyPropertiesSecurityRealm.BuildersetPlainText(boolean plainText)Set format of users property file - if the passwords are stored in plain text.LegacyPropertiesSecurityRealm.BuildersetProviders(Supplier<Provider[]> providers)Set the supplier forProviderinstanced for use bu the realm.LegacyPropertiesSecurityRealm.BuildersetUsersStream(InputStream usersStream)Set theInputStreamto 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 forProviderinstanced for use bu the realm.- Parameters:
providers- the supplier forProviderinstanced for use bu the realm.- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setUsersStream
public LegacyPropertiesSecurityRealm.Builder setUsersStream(InputStream usersStream)
Set theInputStreamto use to load the users.- Parameters:
usersStream- theInputStreamto use to load the users.- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setGroupsStream
public LegacyPropertiesSecurityRealm.Builder setGroupsStream(InputStream groupsStream)
Set theInputStreamto use to load the group information.- Parameters:
groupsStream- theInputStreamto use to load the group information.- Returns:
- this
LegacyPropertiesSecurityRealm.Builder
-
setGroupsAttribute
public LegacyPropertiesSecurityRealm.Builder setGroupsAttribute(String groupsAttribute)
Where this realm returns anAuthorizationIdentityset 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
-
-