This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-xing-oauth.git
commit 88e69e9a40db34d82157582e95dfc4f098f7abfe Author: Oliver Lietz <[email protected]> AuthorDate: Sun Jul 6 13:53:01 2014 +0000 SLING-3731 null out OAuthService on incomplete configuration parameters and add OAuthService null checks git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1608200 13f79535-47bb-0310-9956-ffa450edef68 --- .../xing/oauth/impl/XingOauthAuthenticationHandler.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/org/apache/sling/auth/xing/oauth/impl/XingOauthAuthenticationHandler.java b/src/main/java/org/apache/sling/auth/xing/oauth/impl/XingOauthAuthenticationHandler.java index 79f58d0..1ee4e47 100644 --- a/src/main/java/org/apache/sling/auth/xing/oauth/impl/XingOauthAuthenticationHandler.java +++ b/src/main/java/org/apache/sling/auth/xing/oauth/impl/XingOauthAuthenticationHandler.java @@ -147,6 +147,8 @@ public class XingOauthAuthenticationHandler extends DefaultAuthenticationFeedbac if (!StringUtils.isEmpty(consumerKey) && !StringUtils.isEmpty(consumerSecret) && !StringUtils.isEmpty(callbackUrl)) { oAuthService = new ServiceBuilder().provider(XingApi.class).apiKey(consumerKey).apiSecret(consumerSecret).callback(callbackUrl).build(); + } else { + oAuthService = null; } logger.info("configured with consumer key '{}', callback url '{}' and users me url '{}'", consumerKey, callbackUrl, usersMeUrl); @@ -157,6 +159,11 @@ public class XingOauthAuthenticationHandler extends DefaultAuthenticationFeedbac public AuthenticationInfo extractCredentials(final HttpServletRequest request, final HttpServletResponse response) { logger.debug("extract credentials"); + if (oAuthService == null) { + logger.error("OAuthService is null, check configuration"); + return null; + } + try { final HttpSession httpSession = request.getSession(true); @@ -195,6 +202,12 @@ public class XingOauthAuthenticationHandler extends DefaultAuthenticationFeedbac @Override public boolean requestCredentials(final HttpServletRequest request, final HttpServletResponse response) throws IOException { logger.debug("request credentials"); + + if (oAuthService == null) { + logger.error("OAuthService is null, check configuration"); + return false; + } + try { final Token requestToken = oAuthService.getRequestToken(); logger.debug("received request token: '{}'", requestToken); -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
