io.vertx.ext.auth.jdbc.JDBCAuth Java Examples
The following examples show how to use
io.vertx.ext.auth.jdbc.JDBCAuth.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JDBCShellAuth.java From vertx-shell with Apache License 2.0 | 5 votes |
@Override public AuthProvider create(Vertx vertx, JsonObject config) { final JDBCAuthOptions options = new JDBCAuthOptions(config); final JDBCClient client; if (options.isShared()) { String datasourceName = options.getDatasourceName(); if (datasourceName != null) { client = JDBCClient.createShared(vertx, options.getConfig(), datasourceName); } else { client = JDBCClient.createShared(vertx, options.getConfig()); } } else { client = JDBCClient.create(vertx, options.getConfig()); } final JDBCAuth auth = JDBCAuth.create(vertx, client); if (options.getAuthenticationQuery() != null) { auth.setAuthenticationQuery(options.getAuthenticationQuery()); } if (options.getRolesQuery() != null) { auth.setRolesQuery(options.getRolesQuery()); } if (options.getPermissionsQuery() != null) { auth.setPermissionsQuery(options.getPermissionsQuery()); } if (options.getRolesPrefix() != null) { auth.setRolePrefix(options.getRolesPrefix()); } return auth; }
Example #2
Source File: Config.java From nubes with Apache License 2.0 | 5 votes |
private void createAuthHandlers() { String auth = json.getString("auth-type"); JsonObject authProperties = json.getJsonObject("auth-properties"); // TODO : discuss it. I'm really not convinced about all the boilerplate needed in config (dbName only for JDBC, etc.) if (authProperties != null) { // For now, only JWT,Shiro and JDBC supported (same as for Vert.x web) switch (auth) { case "JWT":// For now only allow properties realm this.authProvider = JWTAuth.create(vertx, authProperties); break; case "Shiro": ShiroAuth.create(vertx, new ShiroAuthOptions(authProperties)); break; case "JDBC": String dbName = json.getString("db-name"); Objects.requireNonNull(dbName); JDBCClient client = JDBCClient.createShared(vertx, authProperties, dbName); this.authProvider = JDBCAuth.create(vertx, client); break; default: LOG.warn("Unknown type of auth : " + auth + " . Ignoring."); } } else if (auth != null) { LOG.warn("You have defined " + auth + " as auth type, but didn't provide any configuration, can't create authProvider"); } }
Example #3
Source File: JDBCAuthImpl.java From vertx-auth with Apache License 2.0 | 5 votes |
@Override public JDBCAuth setHashStrategy(JDBCHashStrategy strategy) { this.hashStrategy = Objects.requireNonNull(strategy); // we've got to recreate the authenticationProvider provider to pick-up the new hash strategy this.authenticationProvider = JDBCAuthentication.create(client, strategy, authenticationOptions); return this; }
Example #4
Source File: JDBCAuthImpl.java From vertx-auth with Apache License 2.0 | 4 votes |
@Override public JDBCAuth setAuthenticationQuery(String authenticationQuery) { this.authenticationOptions.setAuthenticationQuery(authenticationQuery); return this; }
Example #5
Source File: JDBCAuthImpl.java From vertx-auth with Apache License 2.0 | 4 votes |
@Override public JDBCAuth setRolesQuery(String rolesQuery) { this.authorizationOptions.setRolesQuery(rolesQuery); return this; }
Example #6
Source File: JDBCAuthImpl.java From vertx-auth with Apache License 2.0 | 4 votes |
@Override public JDBCAuth setPermissionsQuery(String permissionsQuery) { this.authorizationOptions.setPermissionsQuery(permissionsQuery); return this; }
Example #7
Source File: JDBCAuthImpl.java From vertx-auth with Apache License 2.0 | 4 votes |
@Override public JDBCAuth setRolePrefix(String rolePrefix) { return this; }
Example #8
Source File: JDBCAuthImpl.java From vertx-auth with Apache License 2.0 | 4 votes |
@Override public JDBCAuth setNonces(JsonArray nonces) { hashStrategy.setNonces(nonces); return this; }
Example #9
Source File: JDBCAuthTest.java From vertx-auth with Apache License 2.0 | 4 votes |
protected JDBCAuth createProvider() { JDBCClient client = JDBCClient.create(vertx, config()); return JDBCAuth.create(vertx, client); }