Fix the disable failier of the authenticator

revert-70aa11f8
Kamidu Sachith 9 years ago
parent 93a295f8a7
commit 7b544f3545

@ -59,14 +59,16 @@ public class OauthAuthenticator implements CarbonServerAuthenticator {
*/ */
public boolean isHandle(MessageContext messageContext) { public boolean isHandle(MessageContext messageContext) {
HttpServletRequest httpServletRequest = getHttpRequest(messageContext); HttpServletRequest httpServletRequest = getHttpRequest(messageContext);
String headerValue = httpServletRequest.getHeader(HTTPConstants.HEADER_AUTHORIZATION); if(httpServletRequest != null) {
if (headerValue != null && !headerValue.trim().isEmpty()) { String headerValue = httpServletRequest.getHeader(HTTPConstants.HEADER_AUTHORIZATION);
String[] headerPart = headerValue.trim().split(OauthAuthenticatorConstants.SPLITING_CHARACTOR); if (headerValue != null && !headerValue.trim().isEmpty()) {
if (OauthAuthenticatorConstants.AUTHORIZATION_HEADER_PREFIX_BEARER.equals(headerPart[0])) { String[] headerPart = headerValue.trim().split(OauthAuthenticatorConstants.SPLITING_CHARACTOR);
if (OauthAuthenticatorConstants.AUTHORIZATION_HEADER_PREFIX_BEARER.equals(headerPart[0])) {
return true;
}
} else if (httpServletRequest.getParameter(OauthAuthenticatorConstants.BEARER_TOKEN_IDENTIFIER) != null) {
return true; return true;
} }
} else if (httpServletRequest.getParameter(OauthAuthenticatorConstants.BEARER_TOKEN_IDENTIFIER) != null) {
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