paascloud/paascloud-master · error · AuthenticationServiceException

Authentication method not supported:

Error message

Authentication method not supported: 

What it means

SmsCodeAuthenticationFilter.attemptAuthentication throws AuthenticationServiceException('Authentication method not supported: ' + method) when the SMS-code login endpoint is hit with a non-POST method while postOnly is true (default). Only POST requests carrying the mobile parameter are processed by this filter.

Solutions

  1. Issue the SMS login request as HTTP POST with the mobile parameter.
  2. If non-POST access must be allowed, construct SmsCodeAuthenticationFilter with postOnly=false.
  3. Fix client redirect logic so the login form actually POSTs to the filter URL.
  4. Confirm the filter's request matcher matches the URL your client posts to.

Example fix

// before
fetch('/auth/mobile?mobile=13800000000')  // GET
// after
fetch('/auth/mobile', { method: 'POST', body: new URLSearchParams({ mobile: '13800000000' }) })
Defensive patterns

Strategy: validation

Validate before calling

if (!"POST".equalsIgnoreCase(httpMethod)) {
    throw new IllegalArgumentException("SMS login must be POST");
}
if (mobile == null || mobile.isBlank()) {
    throw new IllegalArgumentException("mobile is required");
}

Try / catch

try {
    Authentication result = filter.attemptAuthentication(request, response);
} catch (AuthenticationServiceException e) {
    response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Use POST");
}

Prevention

When it happens

Trigger: GET (or PUT/DELETE) request to the SMS authentication processing URL (default /auth/mobile) — e.g. typing the URL in a browser, a curl GET, or a client redirect that converts POST to GET.

Common situations: Manually testing the mobile login endpoint; frontend issuing redirect after failure which re-requests with GET; gateway rewrite of the method; missing -X POST in curl tests.

Understand the failure class

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/b70a41ab0c1a9177. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-common/paascloud-security-core/src/main/java/com/paascloud/security/core/authentication/mobile/SmsCodeAuthenticationFilter.java:54

	// ~ 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 mobile = obtainMobile(request);

		if (mobile == null) {
			mobile = "";
		}

		mobile = mobile.trim();

		SmsCodeAuthenticationToken authRequest = new SmsCodeAuthenticationToken(mobile);

		// Allow subclasses to set the "details" property
		setDetails(request, authRequest);

		return this.getAuthenticationManager().authenticate(authRequest);
	}

View on GitHub (pinned to 781281a950)