Merge pull request #97 from Kamidu/master

Fix for the disable failier of the backend oauth authenticator
4.x.x
Kasun Delgolla 9 years ago
commit 8c18935a33

@ -59,6 +59,7 @@ public class OauthAuthenticator implements CarbonServerAuthenticator {
*/ */
public boolean isHandle(MessageContext messageContext) { public boolean isHandle(MessageContext messageContext) {
HttpServletRequest httpServletRequest = getHttpRequest(messageContext); HttpServletRequest httpServletRequest = getHttpRequest(messageContext);
if(httpServletRequest != null) {
String headerValue = httpServletRequest.getHeader(HTTPConstants.HEADER_AUTHORIZATION); String headerValue = httpServletRequest.getHeader(HTTPConstants.HEADER_AUTHORIZATION);
if (headerValue != null && !headerValue.trim().isEmpty()) { if (headerValue != null && !headerValue.trim().isEmpty()) {
String[] headerPart = headerValue.trim().split(OauthAuthenticatorConstants.SPLITING_CHARACTOR); String[] headerPart = headerValue.trim().split(OauthAuthenticatorConstants.SPLITING_CHARACTOR);
@ -68,6 +69,7 @@ public class OauthAuthenticator implements CarbonServerAuthenticator {
} else if (httpServletRequest.getParameter(OauthAuthenticatorConstants.BEARER_TOKEN_IDENTIFIER) != null) { } else if (httpServletRequest.getParameter(OauthAuthenticatorConstants.BEARER_TOKEN_IDENTIFIER) != null) {
return true; return true;
} }
}
return false; return false;
} }
@ -134,7 +136,10 @@ public class OauthAuthenticator implements CarbonServerAuthenticator {
* @return boolean true for enable or otherwise for disable status. * @return boolean true for enable or otherwise for disable status.
*/ */
public boolean isDisabled() { public boolean isDisabled() {
return false; AuthenticatorsConfiguration authenticatorsConfiguration = AuthenticatorsConfiguration.getInstance();
AuthenticatorsConfiguration.AuthenticatorConfig authenticatorConfig = authenticatorsConfiguration.
getAuthenticatorConfig(OauthAuthenticatorConstants.AUTHENTICATOR_NAME);
return authenticatorConfig.isDisabled();
} }
/** /**

Loading…
Cancel
Save