mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
25 lines
665 B
Java
25 lines
665 B
Java
package sonia.scm.security;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.util.regex.Pattern;
|
|
|
|
/**
|
|
* Created by masuewer on 04.07.18.
|
|
*/
|
|
public final class SecurityRequests {
|
|
|
|
private static final Pattern URI_LOGIN_PATTERN = Pattern.compile("/api/rest(?:/v2)?/auth/access_token");
|
|
|
|
private SecurityRequests() {}
|
|
|
|
public static boolean isAuthenticationRequest(HttpServletRequest request) {
|
|
String uri = request.getRequestURI().substring(request.getContextPath().length());
|
|
return isAuthenticationRequest(uri);
|
|
}
|
|
|
|
public static boolean isAuthenticationRequest(String uri) {
|
|
return URI_LOGIN_PATTERN.matcher(uri).matches();
|
|
}
|
|
|
|
}
|