Package com.foundationdb.server.service.security

Examples of com.foundationdb.server.service.security.User


    protected void loadUsers() {
    }

    @Override
    protected UserIdentity loadUser(String username) {
        User user = securityService.getUser(username);
        if(user != null) {
            String password = (credentialType == CredentialType.BASIC) ? user.getBasicPassword() : user.getDigestPassword();
            List<String> roles = user.getRoles();
            return putUser(username, Credential.getCredential(password), roles.toArray(new String[roles.size()]));
        }
        return null;
    }
View Full Code Here


            roles.add(elem.asText());
        }
        response.body(new RestResponseBuilder.BodyGenerator() {
            @Override
            public void write(PrintWriter writer) throws Exception {
                User newUser = reqs.securityService.addUser(user, password, roles);
                writer.write("{\"id\":");
                writer.print(newUser.getId());
                writer.write('}');
            }
        });
        return response.build();
    }
View Full Code Here

        return driver;
    }

    @Override
    public Connection newConnection(Properties properties, Principal principal) throws SQLException {
        User user = null;
        if (principal != null) {
            if (principal instanceof User) {
                user = (User)principal;
            }
            else {
                // Translate from Java security realm (e.g., Jetty) to SQL Layer.
                user = reqs.securityService().getUser(principal.getName());
            }
        }
        if (user != null) {
            properties.put("user", user.getName());
            properties.put("database", user.getName());
        }
        else if (!properties.containsKey("user")) {
            properties.put("user", ""); // Avoid NPE.
        }
        Connection conn = driver.connect(JDBCDriver.URL, properties);
View Full Code Here

TOP

Related Classes of com.foundationdb.server.service.security.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.