Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
7.1.X, 7.2.X, Master
-
7.2.x, 7.1.x
-
Committed
-
3
Description
OAuth 2 uses the "Bearer" scheme to send access tokens to API endpoints. If that same endpoint also support BASIC authentication (i.e. both processed by AuthVerifierPipeline) then a DEBUG statement is logged with the following stack trace.
Caused by: java.lang.UnsupportedOperationException: Scheme Bearer at com.liferay.portal.security.auth.http.HttpAuthManagerImpl.parse(HttpAuthManagerImpl.java:209) at com.liferay.portal.kernel.security.auth.http.HttpAuthManagerUtil.parse(HttpAuthManagerUtil.java:63) at com.liferay.portal.security.auto.login.basic.auth.header.BasicAuthHeaderAutoLoginSupport.doLogin(BasicAuthHeaderAutoLoginSupport.java:45) at com.liferay.portal.kernel.security.auto.login.BaseAutoLogin.login(BaseAutoLogin.java:50) ... 73 more
This is because HttpAuthManagerImpl.parse() does not recognize "Bearer".
It should be recognized so that the calling code in BasicAuthHeaderAutoLoginSupport() can gracefully return null, meaning this request cannot be handled by it.
Steps to Reproduce
- Set the logging level for com.liferay.portal.security.auth to DEBUG
- Use a browser modify headers plugin to set the "Authorization: Bearer mF_9.B5f-4.1JqM" example header described in https://tools.ietf.org/html/rfc6750
- Visit http://localhost:8080/api/jsonws/country/get-countries
Expected behavior is that since Bearer is a valid authorization scheme, nothing should happen.
Actual behavior is that the implementation for basic authentication's attempt to check whether its own authorization scheme (Basic) is present on the request results in an exception being thrown.