org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilterCustom Maven / Gradle / Ivy
package org.springframework.security.web.authentication;
import javax.servlet.http.HttpServletRequest;
public class UsernamePasswordAuthenticationFilterCustom extends org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter {
@Override
protected String obtainUsername(HttpServletRequest request) {
String username = super.obtainUsername(request);
if (username == null) {
return null;
}
int indexOf = username.indexOf('@');
if (indexOf != -1) {
username = username.substring(0, indexOf);
}
return username;
}
}