paascloud/paascloud-master · error · AuthenticationServiceException
Authentication method not supported:
Error message
Authentication method not supported:
What it means
OpenIdAuthenticationFilter.attemptAuthentication throws AuthenticationServiceException('Authentication method not supported: ' + method) when the openid login request arrives with an HTTP method other than POST while postOnly is enabled. The filter only accepts form-submitted POST requests carrying openid and providerId parameters.
Solutions
- Send the openid authentication request as an HTTP POST with openid and providerId parameters.
- If GET access is intentionally required, construct OpenIdAuthenticationFilter with postOnly=false.
- Check client code/redirect chain so the auth URL is not reached via GET redirect.
- Verify the security config maps the correct request matcher URL to this filter.
Example fix
// before curl 'http://host/auth/openid?openid=o123&providerId=weixin' // after curl -X POST 'http://host/auth/openid' -d 'openid=o123' -d 'providerId=weixin'
Defensive patterns
Strategy: validation
Validate before calling
if (request.getMethod() != null && !"POST".equalsIgnoreCase(request.getMethod())) {
throw new IllegalArgumentException("openid login must be POST");
} Try / catch
try {
Authentication result = filter.attemptAuthentication(request, response);
} catch (AuthenticationServiceException e) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Use POST");
} Prevention
- Always POST openid credentials as form parameters.
- Keep postOnly=true in production to reject GET probing.
- Test the auth endpoint with POST only in curl/Postman.
When it happens
Trigger: Sending a GET request to the openid auth processing URL (default /auth/openid) with postOnly=true (the default). E.g. calling the endpoint from a browser address bar, a curl GET, or a link/redirect instead of a form POST.
Common situations: Testing the endpoint manually with GET; frontend performing a redirect instead of a form submit; misconfigured client issuing HEAD/PUT to the auth URL; API gateway rewriting POST to GET on redirect.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Authentication method not supported:
- 无法获取用户信息
- UsernameNotFoundException(userId)
- UsernameNotFoundException(username)
- 无法获取用户信息
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/fc37f2d4003178fd.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-common/paascloud-security-app/src/main/java/com/paascloud/security/app/authentication/openid/OpenIdAuthenticationFilter.java:66
// ~ Methods
// ========================================================================================================
/**
* Attempt authentication authentication.
*
* @param request the request
* @param response the response
*
* @return the authentication
*
* @throws AuthenticationException the authentication exception
*/
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws AuthenticationException {
if (postOnly && !POST.equals(request.getMethod())) {
throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
}
String openid = obtainOpenId(request);
String providerId = obtainProviderId(request);
if (openid == null) {
openid = "";
}
if (providerId == null) {
providerId = "";
}
openid = openid.trim();
providerId = providerId.trim();
OpenIdAuthenticationToken authRequest = new OpenIdAuthenticationToken(openid, providerId);
// Allow subclasses to set the "details" propertyView on GitHub (pinned to 781281a950)