Class QueryBuilder
java.lang.Object
org.wildfly.security.auth.realm.jdbc.JdbcSecurityRealmBuilder
org.wildfly.security.auth.realm.jdbc.QueryBuilder
A builder class with different configuration options to configure queries.
- Author:
- Pedro Igor
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newJdbcSecurityRealminstance based on configuration defined for thisJdbcSecurityRealmBuilderinstance.from(DataSource dataSource) Defines theDataSourcefrom where connections are obtained.principalQuery(String sql) A SQL SELECT statement that will be used to return data from a database based on the principal's name.setProviders(Supplier<Provider[]> providers) Set the providers to be used by the realm.withMapper(ColumnMapper... mapper) Defines a mapper that will be applied to the query in order to map the returned columns to some internal representation.Methods inherited from class org.wildfly.security.auth.realm.jdbc.JdbcSecurityRealmBuilder
setHashCharset
-
Method Details
-
withMapper
Defines a mapper that will be applied to the query in order to map the returned columns to some internal representation.- Parameters:
mapper- the column mapper instance- Returns:
- this builder
-
from
Defines theDataSourcefrom where connections are obtained.- Parameters:
dataSource- the data source.- Returns:
- this builder
-
principalQuery
Description copied from class:JdbcSecurityRealmBuilderA SQL SELECT statement that will be used to return data from a database based on the principal's name.
When authenticating, validating or obtaining credentials for a
RealmIdentity, this query will be used. You must provide a SELECT with a single query parameter as follows:JdbcSecurityRealm securityRealm = JdbcSecurityRealm.builder().principalQuery("SELECT password FROM user_bcrypt_password where name = ?")Where the query parameter value would be the principal's name.
- Overrides:
principalQueryin classJdbcSecurityRealmBuilder- Parameters:
sql- the authentication query- Returns:
- this builder
-
setProviders
Description copied from class:JdbcSecurityRealmBuilderSet the providers to be used by the realm.- Overrides:
setProvidersin classJdbcSecurityRealmBuilder- Parameters:
providers- the providers to be used by the realm.- Returns:
- this builder.
-
build
Description copied from class:JdbcSecurityRealmBuilderBuilds a newJdbcSecurityRealminstance based on configuration defined for thisJdbcSecurityRealmBuilderinstance.- Overrides:
buildin classJdbcSecurityRealmBuilder- Returns:
- the built realm
-