Issue #152 Use CommonUtils for null checks.
This commit is contained in:
parent
40291a4478
commit
812198b6a5
|
|
@ -1,6 +1,7 @@
|
|||
package org.jasig.cas.client.jetty;
|
||||
|
||||
import org.eclipse.jetty.security.UserAuthentication;
|
||||
import org.jasig.cas.client.util.CommonUtils;
|
||||
import org.jasig.cas.client.validation.Assertion;
|
||||
|
||||
/**
|
||||
|
|
@ -26,8 +27,8 @@ public class CasAuthentication extends UserAuthentication {
|
|||
*/
|
||||
public CasAuthentication(final CasAuthenticator authenticator, final String ticket, final Assertion assertion) {
|
||||
super(authenticator.getAuthMethod(), new CasUserIdentity(assertion, authenticator.getRoleAttribute()));
|
||||
assert ticket != null : "Ticket cannot be null";
|
||||
assert authenticator != null : "CasAuthenticator cannot be null";
|
||||
CommonUtils.assertNotNull(ticket, "Ticket cannot be null");
|
||||
CommonUtils.assertNotNull(authenticator, "CasAuthenticator cannot be null");
|
||||
this.authenticator = authenticator;
|
||||
this.ticket = ticket;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class CasAuthenticator extends AbstractLifeCycle implements Authenticator
|
|||
* @param ticketValidator Ticket validator, MUST NOT be null.
|
||||
*/
|
||||
public void setTicketValidator(final TicketValidator ticketValidator) {
|
||||
assert ticketValidator != null : "TicketValidator cannot be null";
|
||||
CommonUtils.assertNotNull(ticketValidator, "TicketValidator cannot be null");
|
||||
if (ticketValidator instanceof AbstractUrlBasedTicketValidator) {
|
||||
if (ticketValidator instanceof AbstractCasProtocolUrlBasedTicketValidator) {
|
||||
protocol = Protocol.CAS2;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.jasig.cas.client.jetty;
|
|||
|
||||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.jasig.cas.client.authentication.AttributePrincipal;
|
||||
import org.jasig.cas.client.util.CommonUtils;
|
||||
import org.jasig.cas.client.validation.Assertion;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
|
|
@ -29,7 +30,7 @@ public class CasUserIdentity implements UserIdentity {
|
|||
* @param roleAttribute Principal attribute containing role data.
|
||||
*/
|
||||
public CasUserIdentity(final Assertion assertion, final String roleAttribute) {
|
||||
assert assertion != null : "Assertion cannot be null";
|
||||
CommonUtils.assertNotNull(assertion, "Assertion cannot be null");
|
||||
this.principal = assertion.getPrincipal();
|
||||
this.roleAttribute = roleAttribute;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue