changes in CAS, CAS-client-java to send password
Scott Battaglia
scott.battaglia at gmail.com
Wed Jun 6 07:58:56 EDT 2007
The actual HttpServletRequest interface does not have that method. You
would probably need to cast it to your exact class before attempting to
access it.
-Scott
On 6/6/07, Adrien Futschik <adrien.futschik at atosorigin.com> wrote:
>
> I am trying to modify CAS 3.0.7 and CAS-client-java 2.1.1 to exchange
> password.
>
> In CAS, I have created a new class called :
>
> public class AdvancedPrincipal implements Principal {
>
> /** Unique ID for serialization. */
> private static final long serialVersionUID = 3977857758779396149L;
>
> /** User Id */
> private final String id;
>
> /** Password */
> private final String password;
>
> /**
> * Constructs the AdvancedPrincipal using the provided unique id and
> password.
> *
> * @param id the identifier for the Principal
> * @param password the password for the Principal
> * @throws IllegalArgumentException if the id is null
> */
> public AdvancedPrincipal(final String id, final String password) {
> Assert.notNull(id, "id cannot be null");
> this.id = id;
> Assert.notNull(password, "password cannot be null");
> this.password = password;
> }
>
> public final String getId() {
> return this.id;
> }
>
> public final String getPassword() {
> return this.password;
> }
>
> public boolean equals(final Object o) {
> if (o == null || !this.getClass().equals(o.getClass())) {
> return false;
> }
>
> final AdvancedPrincipal p = (AdvancedPrincipal) o;
>
> return this.id.equals(p.getId());
> }
>
> public String toString() {
> return this.id + "|" + this.password;
> }
>
> public int hashCode() {
> return super.hashCode() ^ this.id.hashCode();
> }
> }
>
> An other one called :
>
> public final class UsernameAndPasswordCredentialsToPrincipalResolver
> implements
> CredentialsToPrincipalResolver {
>
> /** Logging instance. */
> private final Log log = LogFactory.getLog(getClass());
>
> /**
> * Constructs a AdvancedPrincipal from the username provided in the
> * credentials.
> *
> * @param credentials the Username and Password provided as
> credentials.
> * @return an instance of the principal where the id is the username.
> */
> public Principal resolvePrincipal(final Credentials credentials) {
> final UsernamePasswordCredentials usernamePasswordCredentials =
> (UsernamePasswordCredentials) credentials;
>
> if (log.isDebugEnabled()) {
> log.debug("Creating AdvancedPrincipal for ["
> + usernamePasswordCredentials.getUsername() + "]");
> }
>
> return new
> AdvancedPrincipal(usernamePasswordCredentials.getUsername(),
> usernamePasswordCredentials.getPassword());
> }
>
> /**
> * Return true if Credentials are UsernamePasswordCredentials, false
> * otherwise.
> */
> public boolean supports(final Credentials credentials) {
> return credentials != null
> && UsernamePasswordCredentials.class.isAssignableFrom
> (credentials
> .getClass());
> }
> }
>
> I have declared in deployerConfigContext.xml :
> <bean
> class="
> org.jasig.cas.authentication.principal.UsernameAndPasswordCredentialsToPrincipalResolver"
> />
>
> instead of <bean
>
> class="
> org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver"
> /> ...
>
> In Cas-client-java , I have added a method in CASFilterRequestWrapper.java
> called getRemotePassword()
>
> I also added this declaration in CASFilter.java
> /** <p>Session attribute in which the password is stored.</p> */
> public final static String CAS_FILTER_PASSWORD
> = "edu.yale.its.tp.cas.client.filter.password";
>
> But when I am trying to use this method(getRemotePassword()) in my Jsp
> page,
> I am getting this error :
> The method getRemotePassword() is undefined for the type
> HttpServletRequest
> 26: <TR><TD><BR/></TD></TR>
> 27: <TR><TD align="left">Login : </TD>
> 28: <TD>
> 29: <html:text property="login" size="20"
> maxlength="128"
> value="<%=request.getRemotePassword()%>" />
> 30: </TD>
> 31: </TR>
> 32: <TR><TD><BR/></TD></TR>
> ....
>
> Any ideas on how to make this work ??
> --
> Futschik Adrien
> Atos Origin
> Tour "Les Miroirs"
> 18, avenue d'Alsace
> 92296 Paris La Défense Cedex
> FRANCE
>
> Phone: +33 (0) 1 55 91 24 82
>
> adrien.futschik at atosorigin.com
> www.si.fr.atosorigin.com
> _______________________________________________
> Yale CAS mailing list
> cas at tp.its.yale.edu
> http://tp.its.yale.edu/mailman/listinfo/cas
>
--
-Scott Battaglia
LinkedIn: http://www.linkedin.com/in/scottbattaglia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tp.its.yale.edu/pipermail/cas/attachments/20070606/35ce63ca/attachment.html
More information about the cas
mailing list