On Wednesday 06 June 2007 13:58:56 Scott Battaglia wrote:
> 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 <[EMAIL PROTECTED]> 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.UsernameAndPasswordCredentialsToPr
> >incipalResolver" />
> >
> > instead of <bean
> >
> > class="
> > org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrinc
> >ipalResolver" /> ...
> >
> > 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
> >
> > [EMAIL PROTECTED]
> > www.si.fr.atosorigin.com
> > _______________________________________________
> > Yale CAS mailing list
> > [email protected]
> > http://tp.its.yale.edu/mailman/listinfo/cas
I have tried something else :
<TD>
<html:text property="login" size="20" maxlength="128"
value="<%=edu.yale.its.tp.cas.client.filter.CASFilterRequestWrapper.getRemotePassword()%>"
/>
</TD>
in my JSP, and now I get an other error :
The method getRemotePassword() is undefined for the type
CASFilterRequestWrapper
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="<%=edu.yale.its.tp.cas.client.filter.CASFilterRequestWrapper.getRemotePassword()%>"
/>
30: </TD>
31: </TR>
32: <TR><TD><BR/></TD></TR>
Stacktrace:
at
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
at
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:317)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
Please help
--
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
[EMAIL PROTECTED]
www.si.fr.atosorigin.com
_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas