/** * <p>A SQL SELECT statement that will be used to return data from a database based on the principal's name. * * <p>When authenticating, validating or obtaining credentials for a {@link RealmIdentity}, * this query will be used. You must provide a SELECT with a single query parameter as follows: * * <pre> * JdbcSecurityRealm securityRealm = JdbcSecurityRealm.builder().principalQuery("SELECT password FROM user_bcrypt_password where name = ?") * </pre> * * <p>Where the query parameter value would be the principal's name. * * @param sql the authentication query * @return this builder */ public QueryBuilder principalQuery(String sql) { QueryBuilder builder = new QueryBuilder(sql, this); this.queries.add(builder); return builder; } }
/** * Builds a new {@link JdbcSecurityRealm} instance based on configuration defined for this {@link JdbcSecurityRealmBuilder} instance. * * @return the built realm */ public JdbcSecurityRealm build() { List<QueryConfiguration> configuration = new ArrayList<>(); for (QueryBuilder query : this.queries) { configuration.add(query.buildQuery()); } return new JdbcSecurityRealm(configuration, providers); }
@Override public void inject(DataSource value) throws InjectionException { queryBuilder.from(value); }
String authenticationQuerySql = PrincipalQueryAttributes.SQL.resolveModelAttribute(context, query).asString(); QueryBuilder queryBuilder = builder.principalQuery(authenticationQuerySql) .withMapper(resolveAttributeMappers(context, query)) .withMapper(resolveKeyMappers(context, query));
/** * Builds a new {@link JdbcSecurityRealm} instance based on configuration defined for this {@link JdbcSecurityRealmBuilder} instance. * * @return the built realm */ public JdbcSecurityRealm build() { List<QueryConfiguration> configuration = new ArrayList<>(); for (QueryBuilder query : this.queries) { configuration.add(query.buildQuery()); } return new JdbcSecurityRealm(configuration, providers); }
/** * <p>A SQL SELECT statement that will be used to return data from a database based on the principal's name. * * <p>When authenticating, validating or obtaining credentials for a {@link RealmIdentity}, * this query will be used. You must provide a SELECT with a single query parameter as follows: * * <pre> * JdbcSecurityRealm securityRealm = JdbcSecurityRealm.builder().principalQuery("SELECT password FROM user_bcrypt_password where name = ?") * </pre> * * <p>Where the query parameter value would be the principal's name. * * @param sql the authentication query * @return this builder */ public QueryBuilder principalQuery(String sql) { QueryBuilder builder = new QueryBuilder(sql, this); this.queries.add(builder); return builder; } }
/** * Builds a new {@link JdbcSecurityRealm} instance based on configuration defined for this {@link JdbcSecurityRealmBuilder} instance. * * @return the built realm */ public JdbcSecurityRealm build() { List<QueryConfiguration> configuration = new ArrayList<>(); for (QueryBuilder query : this.queries) { configuration.add(query.buildQuery()); } return new JdbcSecurityRealm(configuration, providers); }
/** * <p>A SQL SELECT statement that will be used to return data from a database based on the principal's name. * * <p>When authenticating, validating or obtaining credentials for a {@link RealmIdentity}, * this query will be used. You must provide a SELECT with a single query parameter as follows: * * <pre> * JdbcSecurityRealm securityRealm = JdbcSecurityRealm.builder().principalQuery("SELECT password FROM user_bcrypt_password where name = ?") * </pre> * * <p>Where the query parameter value would be the principal's name. * * @param sql the authentication query * @return this builder */ public QueryBuilder principalQuery(String sql) { QueryBuilder builder = new QueryBuilder(sql, this); this.queries.add(builder); return builder; } }
/** * Builds a new {@link JdbcSecurityRealm} instance based on configuration defined for this {@link JdbcSecurityRealmBuilder} instance. * * @return the built realm */ public JdbcSecurityRealm build() { List<QueryConfiguration> configuration = new ArrayList<>(); for (QueryBuilder query : this.queries) { configuration.add(query.buildQuery()); } return new JdbcSecurityRealm(configuration, providers); }
/** * <p>A SQL SELECT statement that will be used to return data from a database based on the principal's name. * * <p>When authenticating, validating or obtaining credentials for a {@link RealmIdentity}, * this query will be used. You must provide a SELECT with a single query parameter as follows: * * <pre> * JdbcSecurityRealm securityRealm = JdbcSecurityRealm.builder().principalQuery("SELECT password FROM user_bcrypt_password where name = ?") * </pre> * * <p>Where the query parameter value would be the principal's name. * * @param sql the authentication query * @return this builder */ public QueryBuilder principalQuery(String sql) { QueryBuilder builder = new QueryBuilder(sql, this); this.queries.add(builder); return builder; } }