@Override protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException { if (EqualsUtils.objectsNotEqual(userDetails.getUsername(), authentication.getPrincipal())) { throw new BadCredentialsException(CurrentUser.INVALID_USER_NAME_OR_PASSWORD); } if (EqualsUtils.objectsNotEqual(userDetails.getPassword(), authentication.getCredentials())) { throw new BadCredentialsException(CurrentUser.INVALID_USER_NAME_OR_PASSWORD); } }
@Override public void doTag() throws JspException, IOException { if (EqualsUtils.objectsEqual(getVal(), getExp())) { getJspBody().invoke(null); } }
@POST @Path("/update") public Response updateAccount(@FormParam("firstName") String firstName, @FormParam("lastName") String lastName, @FormParam("emailAddress") String newEmailAddress) throws Exception { String oldEmailAddress = account.getEmailAddress(); if (EqualsUtils.objectsNotEqual(oldEmailAddress, newEmailAddress)) { // They are changing the emails address. if (execContext.getAccountStore().getByEmail(newEmailAddress) != null) { String msg = String.format("The email address %s is already in use.", newEmailAddress); throw ApiException.conflict(msg); } } UpdateAccountAction action = new UpdateAccountAction(firstName, lastName, newEmailAddress); account.apply(action); execContext.getAccountStore().update(account); if (EqualsUtils.objectsNotEqual(oldEmailAddress, newEmailAddress)) { // The email address has changed - we will need to update the session execContext.getSessionStore().newSession(newEmailAddress); } execContext.setLastMessage("You account details have been updated."); return Response.seeOther(new URI("manage/account")).build(); }
@POST @Path("/sign-in") @Produces(MediaType.TEXT_HTML) public Response signIn(@FormParam("username") String username, @FormParam("password") String password, @CookieParam(SessionStore.SESSION_COOKIE_NAME) String sessionId) throws Exception { Account account = execContext.getAccountStore().getByEmail(username); if (account == null || EqualsUtils.objectsNotEqual(account.getPassword(), password)) { execContext.getSessionStore().remove(sessionId); NewCookie sessionCookie = SessionStore.toCookie(getUriInfo(), null); URI other = getUriInfo().getBaseUriBuilder().queryParam("r", REASON_CODE_INVALID_USERNAME_OR_PASSWORD).build(); return Response.seeOther(other).cookie(sessionCookie).build(); } Session session = execContext.getSessionStore().newSession(username); NewCookie sessionCookie = SessionStore.toCookie(getUriInfo(), session); URI other = getUriInfo().getBaseUriBuilder().path("manage").build(); return Response.seeOther(other).cookie(sessionCookie).build(); }
if (EqualsUtils.objectsNotEqual(password, domain.getDomainPassword())) { throw new NotAuthorizedException("API");
public LqNotificationsConfig apply(UpdateLqNotificationsConfigAction action) { action.validate(new RequestErrors()).assertNoErrors(); if (domainId != null && EqualsUtils.objectsNotEqual(domainId, action.getDomain().getDomainId())) { String msg = "The specified push and this class are not for the same domain."; throw new IllegalArgumentException(msg); } this.domainId = action.getDomain().getDomainId(); this.configId = LqNotificationsConfigStore.toDocumentId(action.getDomain()); this.userName = action.getUserName(); return this; } }
public GoogleTalkConfig apply(UpdateGoogleTalkConfigAction push) { push.validate(new RequestErrors()).assertNoErrors(); if (domainId != null && EqualsUtils.objectsNotEqual(domainId, push.getDomain().getDomainId())) { String msg = "The specified push and this class are not for the same domain."; throw new IllegalArgumentException(msg); } this.domainId = push.getDomain().getDomainId(); this.configId = GoogleTalkConfigStore.toDocumentId(push.getDomain()); this.userName = push.getUserName(); this.password = push.getPassword(); this.recipientOverride = push.getRecipientOverride(); this.testAddress = push.getTestAddress(); return this; }
public SesEmailConfig apply(UpdateSesEmailConfigAction action) { action.validate(new RequestErrors()).assertNoErrors(); if (domainId != null && EqualsUtils.objectsNotEqual(domainId, action.getDomain().getDomainId())) { String msg = "The specified push and this class are not for the same domain."; throw new IllegalArgumentException(msg); } this.domainId = action.getDomain().getDomainId(); this.configId = SesEmailConfigStore.toDocumentId(action.getDomain()); this.accessKeyId = action.getAccessKeyId(); this.secretKey = action.getSecretKey(); this.endpoint = action.getEndpoint(); this.testToAddress = action.getTestToAddress(); this.testFromAddress = action.getTestFromAddress(); this.recipientOverride = action.getRecipientOverride(); return this; }