Fixed logging issue; returning null in case principal cannot be determined

This commit is contained in:
Misagh Moayyed 2017-06-20 09:21:04 -07:00
parent 9d57eb3655
commit ef2baa8983
1 changed files with 10 additions and 6 deletions

View File

@ -20,15 +20,16 @@ package org.jasig.cas.client.integration.atlassian;
import com.atlassian.confluence.user.ConfluenceAuthenticator;
import com.atlassian.seraph.auth.AuthenticatorException;
import java.security.Principal;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.security.Principal;
/**
* Extension of ConfluenceAuthenticator to allow people to configure Confluence to authenticate
* via CAS.
@ -40,7 +41,9 @@ import org.slf4j.LoggerFactory;
*/
public final class ConfluenceCasAuthenticator extends ConfluenceAuthenticator {
/** ConfluenceCasAuthenticator.java */
/**
* ConfluenceCasAuthenticator.java
*/
private static final long serialVersionUID = -6097438206488390677L;
private static final Logger LOGGER = LoggerFactory.getLogger(ConfluenceCasAuthenticator.class);
@ -61,7 +64,8 @@ public final class ConfluenceCasAuthenticator extends ConfluenceAuthenticator {
// user doesn't exist
if (p == null) {
LOGGER.error("Principal is null for ", assertion.getPrincipal().getName());
LOGGER.error("Could not determine principal for [{}]", assertion.getPrincipal().getName());
return null;
}
LOGGER.debug("Logging in [{}] from CAS.", p.getName());