You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Userobject already accomodates for some more information to be put to it, as well as the SqlAuthenticationOptions hint at the idea of making this aspect at least somewhat configurable.
(By the way, I have to use this feature anyways, because Postgres expects the query placeholder to be $1.)
What I would like to have is that if one sets a different authentication query, one that returns more than a single value, for example SELECT * ..., and then including additional attributes could be implemented like this:
// on SqlAuthenticationOptions
public void addUserAttribute(String attributeName, Function<Row, Object> extractor) {
userAttributeExtractors.put(attributeName, extractor);
}
Simply, when getting this User object from authentication, for the purpose of storing it in a token, or session, one saves haveing to query more information afterwards. Specifically, a user_id field might be something that users of this library would like to be returned as part of the User.
Contribution
I could possibly make a contribution, if the feature is deemed worth implementing.
The text was updated successfully, but these errors were encountered:
Thanks for this report @thokari This sounds like a nice improvement to me.
About implementation, in Vert.x 5 we want option classes to be data only. So if you add Row/User mapping functions, they should be added on the SqlAuth type, not the options.
Describe the feature
I have a specific improvement regarding this part:
https://github.com/eclipse-vertx/vertx-auth/blob/master/vertx-auth-sql-client/src/main/java/io/vertx/ext/auth/sqlclient/impl/SqlAuthenticationImpl.java#L76-L82
The documentation states, that this library requires a table with a username column, and while this column name is hardcoded in the default query (https://github.com/eclipse-vertx/vertx-auth/blob/master/vertx-auth-sql-client/src/main/java/io/vertx/ext/auth/sqlclient/SqlAuthenticationOptions.java#L35) which one can set, but in the code the column name is not mentioned, instead it it assumed that the password is the first string in a single database row.
The
User
object already accomodates for some more information to be put to it, as well as theSqlAuthenticationOptions
hint at the idea of making this aspect at least somewhat configurable.(By the way, I have to use this feature anyways, because Postgres expects the query placeholder to be
$1
.)What I would like to have is that if one sets a different authentication query, one that returns more than a single value, for example
SELECT * ...
, and then including additional attributes could be implemented like this:and usage:
Maybe even this is possible:
Use cases
Simply, when getting this User object from authentication, for the purpose of storing it in a token, or session, one saves haveing to query more information afterwards. Specifically, a
user_id
field might be something that users of this library would like to be returned as part of theUser
.Contribution
I could possibly make a contribution, if the feature is deemed worth implementing.
The text was updated successfully, but these errors were encountered: