List of usage examples for org.apache.commons.lang StringUtils lowerCase
public static String lowerCase(String str)
Converts a String to lower case as per String#toLowerCase() .
From source file:com.epam.trade.storefront.security.AcceleratorAuthenticationProvider.java
@Override public Authentication authenticate(final Authentication authentication) throws AuthenticationException { final String username = (authentication.getPrincipal() == null) ? "NONE_PROVIDED" : authentication.getName();//from w ww . j a v a 2 s . co m if (getBruteForceAttackCounter().isAttack(username)) { try { final UserModel userModel = getUserService().getUserForUID(StringUtils.lowerCase(username)); userModel.setLoginDisabled(true); getModelService().save(userModel); bruteForceAttackCounter.resetUserCounter(userModel.getUid()); } catch (final UnknownIdentifierException e) { LOG.warn("Brute force attack attempt for non existing user name " + username); } finally { throw new BadCredentialsException( messages.getMessage("CoreAuthenticationProvider.badCredentials", "Bad credentials")); } } return super.authenticate(authentication); }
From source file:edu.illinois.cs.cogcomp.wsim.embedding.Embedding.java
/** * get the paragram score for a pair of words. * //w w w . jav a2 s.c o m * @param w1 * @param w2 * @return */ public double simScore(String w1, String w2) { String first = StringUtils.lowerCase(w1); String second = StringUtils.lowerCase(w2); double[] d1 = getVector(first); double[] d2 = getVector(second); if (null == d1 || null == d2) return unknownValue; return cosine(d1, d2); }
From source file:mitm.common.extractor.impl.DetectedMimeTypeImpl.java
@Override public String getSubType() { return StringUtils.lowerCase(mediaType.getSubtype()); }
From source file:com.evolveum.midpoint.prism.match.DistinguishedNameMatchingRule.java
@Override public String normalize(String original) throws SchemaException { if (StringUtils.isBlank(original)) { return null; }//from w w w . j a v a 2 s. com LdapName dn; try { dn = new LdapName(original); } catch (InvalidNameException e) { throw new SchemaException("String '" + original + "' is not a DN: " + e.getMessage(), e); } return StringUtils.lowerCase(dn.toString()); }
From source file:com.epam.training.storefront.security.AcceleratorAuthenticationProvider.java
@Override public Authentication authenticate(final Authentication authentication) throws AuthenticationException { final String username = (authentication.getPrincipal() == null) ? "NONE_PROVIDED" : authentication.getName();//from w w w . ja va 2s .c o m CustomerModel userModel = null; try { userModel = (CustomerModel) getUserService().getUserForUID(StringUtils.lowerCase(username)); } catch (final UnknownIdentifierException e) { LOG.warn("Brute force attack attempt for non existing user name " + username); } if (userModel == null) { throw new BadCredentialsException("Bad credentials"); } if (getBruteForceAttackCounter().isAttack(username)) { userModel.setLoginDisabled(true); userModel.setStatus(Boolean.TRUE); userModel.setAttemptCount(0); getModelService().save(userModel); bruteForceAttackCounter.resetUserCounter(userModel.getUid()); throw new LockedException("Locked account"); } else { userModel.setAttemptCount(bruteForceAttackCounter.getUserFailedLogins(username)); getModelService().save(userModel); } return super.authenticate(authentication); }
From source file:com.acc.storefront.security.AcceleratorAuthenticationProvider.java
@Override public Authentication authenticate(final Authentication authentication) throws AuthenticationException { final String username = (authentication.getPrincipal() == null) ? "NONE_PROVIDED" : authentication.getName();// w w w . j a v a2 s. c om if (getBruteForceAttackCounter().isAttack(username)) { try { final UserModel userModel = getUserService().getUserForUID(StringUtils.lowerCase(username)); userModel.setLoginDisabled(true); getModelService().save(userModel); bruteForceAttackCounter.resetUserCounter(userModel.getUid()); } catch (final UnknownIdentifierException e) { LOG.warn("Brute force attack attempt for non existing user name " + username); } finally { throw new BadCredentialsException( messages.getMessage("CoreAuthenticationProvider.badCredentials", "Bad credentials")); } } checkCartForUser(username); return super.authenticate(authentication); }
From source file:com.epam.cme.storefront.security.AcceleratorAuthenticationProvider.java
@Override public Authentication authenticate(final Authentication authentication) throws AuthenticationException { final String username = (authentication.getPrincipal() == null) ? "NONE_PROVIDED" : authentication.getName();/*from w w w .ja va 2 s.c o m*/ if (getBruteForceAttackCounter().isAttack(username)) { try { final UserModel userModel = getUserService().getUserForUID(StringUtils.lowerCase(username)); userModel.setLoginDisabled(true); getModelService().save(userModel); bruteForceAttackCounter.resetUserCounter(userModel.getUid()); } catch (final UnknownIdentifierException e) { LOG.warn("Brute force attack attempt for non existing user name " + username); } finally { throw new BadCredentialsException( messages.getMessage("CoreAuthenticationProvider.badCredentials", "Bad credentials")); } } checkUserCart(username); return super.authenticate(authentication); }
From source file:com.epam.storefront.security.AcceleratorAuthenticationProvider.java
@Override public Authentication authenticate(final Authentication authentication) throws AuthenticationException { final String username = (authentication.getPrincipal() == null) ? "NONE_PROVIDED" : authentication.getName();//from www .j a v a 2s . co m if (getBruteForceAttackCounter().isAttack(username)) { try { final UserModel userModel = getUserService().getUserForUID(StringUtils.lowerCase(username)); if (userModel instanceof CustomerModel) { final CustomerModel customerModel = (CustomerModel) userModel; customerModel.setLoginDisabled(true); customerModel.setStatus(Boolean.TRUE); customerModel.setAttemptCount(Integer.valueOf(0)); getModelService().save(customerModel); } else { userModel.setLoginDisabled(true); getModelService().save(userModel); } bruteForceAttackCounter.resetUserCounter(userModel.getUid()); } catch (final UnknownIdentifierException e) { LOG.warn("Brute force attack attempt for non existing user name " + username); } finally { throw new BadCredentialsException( messages.getMessage("CoreAuthenticationProvider.badCredentials", "Bad credentials")); } } return doAuth(authentication, username); }
From source file:mitm.common.dlp.impl.MatchFilterRegistryImpl.java
@Override public synchronized MatchFilter getMatchFilter(String name) { if (name == null) { return null; }/*w w w .j ava2s . co m*/ return filters.get(StringUtils.lowerCase(name)); }
From source file:de.hybris.platform.ytelcoacceleratorstorefront.security.AcceleratorAuthenticationProvider.java
@Override public Authentication authenticate(final Authentication authentication) throws AuthenticationException { final String username = (authentication.getPrincipal() == null) ? "NONE_PROVIDED" : authentication.getName();/* w w w . ja v a2s . c o m*/ if (getBruteForceAttackCounter().isAttack(username)) { try { final UserModel userModel = getUserService().getUserForUID(StringUtils.lowerCase(username)); userModel.setLoginDisabled(true); getModelService().save(userModel); bruteForceAttackCounter.resetUserCounter(userModel.getUid()); } catch (final UnknownIdentifierException e) { LOG.warn("Brute force attack attempt for non existing user name " + username); } finally { throw new BadCredentialsException( messages.getMessage("CoreAuthenticationProvider.badCredentials", "Bad credentials")); } } // check if the user of the cart matches the current user and if the // user is not anonymous. If otherwise, remove delete the session cart as it might // be stolen / from another user final String sessionCartUserId = getCartService().getSessionCart().getUser().getUid(); if (!username.equals(sessionCartUserId) && !sessionCartUserId.equals(userService.getAnonymousUser().getUid())) { getCartService().setSessionCart(null); } return super.authenticate(authentication); }