/** * Called back to create a new user when valid credentials are provided. * * @param identifier * The user identifier. * @param request * The request handled. * @param response * The response handled. * @return The {@link User} instance created. */ protected User createUser(String identifier, Request request, Response response) { return new User(identifier); }
/** * Returns the user identifier. * * @see #getIdentifier() */ public String getName() { return getIdentifier(); }
@Override protected User createUser(String identifier, Request request, Response response) { User result = new User(identifier); // Find the reference user User user = findUser(identifier); if (user != null) { // Copy the properties of the reference user result.setEmail(user.getEmail()); result.setFirstName(user.getFirstName()); result.setLastName(user.getLastName()); } return result; }
@Override protected User createUser(final String identifier, final Request request, final Response response) { final User checkUser = RestletUtilMemoryRealm.this.findUser(identifier); if(checkUser == null) { RestletUtilMemoryRealm.this.log.error("Cannot create a user for the given identifier: {}", identifier); throw new IllegalArgumentException("Cannot create a user for the given identifier"); } final User result = new User(identifier, (char[])null, checkUser.getFirstName(), checkUser.getLastName(), checkUser.getEmail()); return result; }
private org.restlet.security.User createRestletUser(User user) { org.restlet.security.User restletUser = new org.restlet.security.User(); restletUser.setIdentifier(user.getId()); restletUser.setLastName(user.getName()); return restletUser; }
public URI addUser(final User nextUser) this.vf.createURI("urn:oas:user:", nextUser.getIdentifier() + ":" + UUID.randomUUID().toString()); this.vf.createLiteral(nextUser.getIdentifier()), true, this.getContexts())); this.vf.createLiteral(nextUser.getIdentifier()), this.getContexts()); if(nextUser.getSecret() != null) this.vf.createLiteral(new String(nextUser.getSecret())), this.getContexts()); if(nextUser.getFirstName() != null) this.vf.createLiteral(nextUser.getFirstName()), this.getContexts()); if(nextUser.getLastName() != null) this.vf.createLiteral(nextUser.getLastName()), this.getContexts()); if(nextUser.getEmail() != null) conn.add(nextUserUUID, SesameRealmConstants.OAS_USEREMAIL, this.vf.createLiteral(nextUser.getEmail()), this.getContexts());
private UnitOfWork createUnitOfWork( Request request ) { UsecaseBuilder usecaseBuilder = UsecaseBuilder.buildUsecase( request.getResourceRef().getIdentifier( true ) ); User user = request.getClientInfo().getUser(); if( user != null ) { UserIdentity userIdentity = new UserIdentity( user.getIdentifier(), user.getName(), user.getEmail(), user.getFirstName(), user.getLastName() ); usecaseBuilder.withMetaInfo( userIdentity ); } return uowf.newUnitOfWork( usecaseBuilder.newUsecase() ); }
@Override public char[] getLocalSecret(final String identifier) { char[] result = null; final User user = RestletUtilMemoryRealm.this.findUser(identifier); if(user != null) { result = user.getSecret(); } return result; } }
if(currentUser != null) dataModel.put("currentUserName", currentUser.getName());
secret = existingUser.getSecret(); email = existingUser.getEmail(); firstName = existingUser.getFirstName(); lastName = existingUser.getLastName(); if(this.getRequest().getClientInfo().getUser().getIdentifier().equalsIgnoreCase(usernameString) || this.getRequest().getClientInfo().getRoles().contains(RestletUtilRoles.ADMIN.getRole()))
@Override public char[] getLocalSecret(final String identifier) { char[] result = null; final User user = RestletUtilSesameRealm.this.findUser(identifier); if(user != null) { result = user.getSecret(); } return result; } }
@Override public String toString() { return getIdentifier(); } }
/** * Creates a new User based on the subject's X500Principal. By default, the * user name is the subject distinguished name, formatted accorded to RFC * 2253. Some may choose to extract the Common Name only, for example. * * @param principal * subject's Principal (most likely X500Principal). * @return User instance corresponding to this principal or null. */ protected User getUser(Principal principal) { if (principal != null) { return new User(principal.getName()); } else { return null; } }
@Override public int verify(String identifier, char[] secret) { char[] actualSecret = null; User user = findUser(identifier); if (user != null) { actualSecret = user.getSecret(); } return compare(secret, actualSecret) ? RESULT_VALID : RESULT_INVALID; } }
@Override public String toString() { return getIdentifier(); } }
/** * Creates a new User based on the subject's X500Principal. By default, the * user name is the subject distinguished name, formatted accorded to RFC * 2253. Some may choose to extract the Common Name only, for example. * * @param principal * subject's Principal (most likely X500Principal). * @return User instance corresponding to this principal or null. */ protected User getUser(Principal principal) { if (principal != null) { return new User(principal.getName()); } else { return null; } }
/** * Returns the user identifier. * * @see #getIdentifier() */ public String getName() { return getIdentifier(); }
/** * Creates a new User based on the subject's X500Principal. By default, the * user name is the subject distinguished name, formatted accorded to RFC * 2253. Some may choose to extract the Common Name only, for example. * * @param principal * subject's Principal (most likely X500Principal). * @return User instance corresponding to this principal or null. */ protected User getUser(Principal principal) { if (principal != null) { return new User(principal.getName()); } else { return null; } }