private BadCredentialsException badCredentials() { return new BadCredentialsException(messages.getMessage( "LdapAuthenticationProvider.badCredentials", "Bad credentials")); }
/** * Set the message source. * * @param messageSource The message source. */ public void setMessageSource(MessageSource messageSource) { this.messages = new MessageSourceAccessor(messageSource); }
/** * Retrieve the message for the given code and the default Locale. * @param code code of the message * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(String code) throws NoSuchMessageException { return this.messageSource.getMessage(code, null, getDefaultLocale()); }
MessageSourceAccessor accessor = new MessageSourceAccessor(ac); LocaleContextHolder.setLocale(new Locale("DE", "at")); try { assertEquals("nochricht2", accessor.getMessage("code2"));
/** * @param message */ public LocaleAwareRuntimeException(String message, Object[] args, MessageSource messageSource) { super(message); MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource); m_localisedMessage = messageSourceAccessor.getMessage(message,args); }
/** * Logic to be performed on a new timestamp. The default behavior expects that the timestamp should not be new. * * @throws org.springframework.security.core.AuthenticationException * If the timestamp shouldn't be new. */ protected void onNewTimestamp() throws AuthenticationException { throw new InvalidOAuthParametersException(messages.getMessage("OAuthProcessingFilter.timestampNotNew", "A new timestamp should not be used in a request for an access token.")); }
/** * Set the message source. * * @param messageSource The message source. */ public void setMessageSource(MessageSource messageSource) { this.messages = new MessageSourceAccessor(messageSource); }
public Button getButtonField(String name, MessageSource messageSource) { MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource); Button ret = new Button(messageSourceAccessor.getMessage(name,null,name)); return ret; } // public void setMessageSource(MessageSource messageSource) {
/** * Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance) * in the default Locale. * @param resolvable the MessageSourceResolvable * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException { return this.messageSource.getMessage(resolvable, getDefaultLocale()); }
public Authentication authenticate(Authentication authentication) throws AuthenticationException { RunAsUserToken token = (RunAsUserToken) authentication; if (token.getKeyHash() == key.hashCode()) { return authentication; } else { throw new BadCredentialsException(messages.getMessage( "RunAsImplAuthenticationProvider.incorrectKey", "The presented RunAsUserToken does not contain the expected key")); } }
/** * Set the message source. * * @param messageSource The message source. */ public void setMessageSource(MessageSource messageSource) { this.messages = new MessageSourceAccessor(messageSource); }
/** * Retrieve the message for the given code and the default Locale. * @param code code of the message * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getMessage(String code, String defaultMessage) { String msg = this.messageSource.getMessage(code, null, defaultMessage, getDefaultLocale()); return (msg != null ? msg : ""); }
@Override protected void onNewTimestamp() throws AuthenticationException { throw new InvalidOAuthParametersException(messages.getMessage("AccessTokenProcessingFilter.timestampNotNew", "A new timestamp should not be used in a request for an access token.")); }
public void setMessageSource(MessageSource messageSource) { this.messages = new MessageSourceAccessor(messageSource); }
/** * Retrieve the message for the given code and the default Locale. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getMessage(String code, @Nullable Object[] args, String defaultMessage) { String msg = this.messageSource.getMessage(code, args, defaultMessage, getDefaultLocale()); return (msg != null ? msg : ""); }
public Authentication authenticate(Authentication authentication) throws AuthenticationException { RunAsUserToken token = (RunAsUserToken) authentication; if (token.getKeyHash() == key.hashCode()) { return authentication; } else { throw new BadCredentialsException(messages.getMessage( "RunAsImplAuthenticationProvider.incorrectKey", "The presented RunAsUserToken does not contain the expected key")); } }
public void setMessageSource(final MessageSource messageSource) { this.messages = new MessageSourceAccessor(messageSource); }
/** * Retrieve the message for the given code and the default Locale. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(String code, @Nullable Object[] args) throws NoSuchMessageException { return this.messageSource.getMessage(code, args, getDefaultLocale()); }
public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!supports(authentication.getClass())) { return null; } if (this.key.hashCode() != ((RememberMeAuthenticationToken) authentication) .getKeyHash()) { throw new BadCredentialsException( messages.getMessage("RememberMeAuthenticationProvider.incorrectKey", "The presented RememberMeAuthenticationToken does not contain the expected key")); } return authentication; }
public void setMessageSource(MessageSource messageSource) { this.messages = new MessageSourceAccessor(messageSource); }