8000 Move creation of HandlerResult up the chain by mmoayyed · Pull Request #1045 · apereo/cas · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Move creation of HandlerResult up the chain #1045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@
*/
package org.jasig.cas.authentication.handler.support;

import org.jasig.cas.MessageDescriptor;
import org.jasig.cas.authentication.AbstractAuthenticationHandler;
import org.jasig.cas.authentication.BasicCredentialMetaData;
import org.jasig.cas.authentication.Credential;
import org.jasig.cas.authentication.DefaultHandlerResult;
import org.jasig.cas.authentication.HandlerResult;
import org.jasig.cas.authentication.PreventedException;
import org.jasig.cas.authentication.principal.Principal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.security.auth.login.FailedLoginException;
import java.security.GeneralSecurityException;
import java.util.List;

/**
* Abstract authentication handler that allows deployers to utilize the bundled
Expand Down Expand Up @@ -93,4 +98,20 @@ public final HandlerResult authenticate(final Credential credential)
*/
protected abstract HandlerResult doAuthentication(final Credential credential)
throws GeneralSecurityException, PreventedException;

/**
* Helper method to construct a handler result
* on successful authentication events.
*
* @param credential the credential on which the authentication was successfully performed.
* Note that this credential instance may be different from what was originally provided
* as transformation of the username may have occurred, if one is in fact defined.
* @param principal the resolved principal
* @param warnings the warnings
* @return the constructed handler result
*/
protected final HandlerResult createHandlerResult(final Credential credential, final Principal principal,
final List<MessageDescriptor> warnings) {
return new DefaultHandlerResult(this, new BasicCredentialMetaData(credential), principal, warnings);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,19 @@
*/
package org.jasig.cas.authentication.handler.support;

import java.security.GeneralSecurityException;
import java.util.List;

import org.jasig.cas.MessageDescriptor;
import org.jasig.cas.authentication.BasicCredentialMetaData;
import org.jasig.cas.authentication.DefaultHandlerResult;
import org.jasig.cas.authentication.Credential;
import org.jasig.cas.authentication.HandlerResult;
import org.jasig.cas.authentication.PreventedException;
import org.jasig.cas.authentication.UsernamePasswordCredential;
import org.jasig.cas.authentication.handler.NoOpPrincipalNameTransformer;
import org.jasig.cas.authentication.handler.PasswordEncoder;
import org.jasig.cas.authentication.handler.PlainTextPasswordEncoder;
import org.jasig.cas.authentication.handler.PrincipalNameTransformer;
import org.jasig.cas.authentication.principal.Principal;
import org.jasig.cas.authentication.support.PasswordPolicyConfiguration;
import org.jasig.cas.authentication.Credential;

import javax.security.auth.login.AccountNotFoundException;
import javax.validation.constraints.NotNull;
import java.security.GeneralSecurityException;

/**
* Abstract class to override supports so that we don't need to duplicate the
Expand Down Expand Up @@ -113,21 +107,6 @@ protected final PasswordPolicyConfiguration getPasswordPolicyConfiguration() {
return this.passwordPolicyConfiguration;
}

/**
* Helper method to construct a handler result
* on successful authentication events.
*
* @param credential the credential on which the authentication was successfully performed.
* Note that this credential instance may be different from what was originally provided
* as transformation of the username may have occurred, if one is in fact defined.
* @param principal the resolved principal
* @param warnings the warnings
* @return the constructed handler result
*/
protected final HandlerResult createHandlerResult(final Credential credential, final Principal principal,
final List<MessageDescriptor> warnings) {
return new DefaultHandlerResult(this, new BasicCredentialMetaData(credential), principal, warnings);
}
/**
* Sets the PasswordEncoder to be used with this class.
*
Expand Down
0