This commit is contained in:
SanteS
2015-04-28 14:43:48 +00:00
parent bf0a405900
commit af65de191f

View File

@@ -20,6 +20,7 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jboss.resteasy.util.Base64;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.security.core.Authentication;
@@ -66,6 +67,17 @@ public class RestSecurityFilter extends GenericFilterBean {
chain.doFilter(request, response);
return;
}
if(credentials.startsWith("Basic ")){
final String encodedUserPassword = credentials.replaceFirst("Basic ", "");
// Decode username and password
try {
credentials = new String(Base64.decode(encodedUserPassword));
} catch (IOException e) {
chain.doFilter(request, response);
return;
}
}
// Authorization header is in the form <public_access_key>:<signature>
String auth[] = credentials.split(":");