Skip to Content.
Sympa Menu

shibboleth-dev - Re: [Shib-Dev] Re: Custom authentication using LdapLoginModule

Subject: Shibboleth Developers

List archive

Re: [Shib-Dev] Re: Custom authentication using LdapLoginModule


Chronological Thread 
  • From: Daniel Mérida <>
  • To:
  • Subject: Re: [Shib-Dev] Re: Custom authentication using LdapLoginModule
  • Date: Tue, 08 Jun 2010 16:21:22 +0200

The file login_jsp.java is located in the idp directory in tomcat. More specifically, the directory is tomcat/work/Catalina/localhost/idp/org/apache/jsp/login_jsp.java
The execution of this class seems to coincide with the login page and my purpose is to customize some lines in the code in order to adapt it to what I need.

Chad La Joie escribió:
There is no such class. Please refer to the documentation for how to configure the login page.

On 6/8/10 5:31 AM, Daniel Mérida wrote:
Hi Chad!

I don't wanna make changes in IdP core classes, only in login_jsp.java
in order to add a different way of provide user-password, instead of the
traditional method of typing them.
Maybe I can do the same by developing a plugin extension, but now I'm
reading/studying the documentation about it and I'm not completely sure
about it.


Chad La Joie escribió:
You should never make changes to the IdP source files themselves. If
there is some bit of information that you can access through the
extension points let us know, but for the most part I think everything
there.

On 6/7/10 11:32 AM, dmerida wrote:

I am going to read the documentation you mention and I will post
about it if
I have any doubts.

A custom extension maybe the best alternative, because the other
alternatives I thought involve little modifications in some idp-src
classes
and the recompilation of full Shibboleth IdP.





package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import edu.internet2.middleware.shibboleth.idp.authn.LoginContext;
import edu.internet2.middleware.shibboleth.idp.session.*;
import edu.internet2.middleware.shibboleth.idp.util.HttpServletHelper;
import org.opensaml.saml2.metadata.*;

public final class login_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {

private static java.util.List _jspx_dependants;

public Object getDependants() {
return _jspx_dependants;
}

public void _jspService(HttpServletRequest request, HttpServletResponse
response)
throws java.io.IOException, ServletException {

JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;


try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;

out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");

LoginContext loginContext =
HttpServletHelper.getLoginContext(HttpServletHelper.getStorageService(application),

application, request);
Session userSession = HttpServletHelper.getUserSession(request);

out.write("\n");
out.write("\n");
out.write("<html>\n");
out.write("\n");
out.write(" <head>\n");
out.write(" <title>Shibboleth Identity Provider -
Login</title>\n");
out.write(" </head>\n");
out.write("\n");
out.write("\t<body>\n");
out.write("\t\t<img src=\"");
out.print( request.getContextPath() );
out.write("/images/logo.jpg\" />\n");
out.write("\t\t<h2>Shibboleth Identity Provider Login to Service
Provider ");
out.print( loginContext.getRelyingPartyId() );
out.write("</h2>\n");
out.write("\t\t<p>\n");
out.write(" Existing Session: ");
out.print( userSession != null );
out.write("<br/>\t\n");
out.write("\t\tRequested Authentication Methods: ");
out.print( loginContext.getRequestedAuthenticationMethods() );
out.write("<br/>\n");
out.write("\t\tAttempting Authentication Method: ");
out.print( loginContext.getAttemptedAuthnMethod() );
out.write(" <br/>\n");
out.write("\t\tIs Forced Authentication: ");
out.print( loginContext.isForceAuthRequired() );
out.write("<br/>\n");
out.write("\t\t</p>\n");
out.write("\t\t\n");
out.write("\t\t");
if ("true".equals(request.getAttribute("loginFailed"))) {
out.write("\n");out.write("\t\t\t\t<td><input name=\"j_password\"
type=\"password\" tabindex=\"2\" /></td>\n");
out.write("\t\t<p><font color=\"red\">Authentication
Failed</font></p>\n");
out.write("\t\t");
}
out.write("\n");
out.write("\t\t\n");
out.write("\t\t");
if(request.getAttribute("actionUrl") != null){
out.write("\n");
out.write("\t\t <form action=\"");
out.print(request.getAttribute("actionUrl"));
out.write("\" method=\"post\">\n");
out.write("\t\t");
}else{
out.write("\n");
out.write("\t\t <form action=\"j_security_check\"
method=\"post\">\n");
out.write("\t\t");
}
out.write("\n");
out.write("\t\t<table>\n");
out.write("\t\t\t<tr>\n");
out.write("Loading credentials from smartcards...");
// out.write("\t\t\t\t<td>Username:</td>\n");
// out.write("\t\t\t\t<td><input name=\"j_username\" type=\"text\"
tabindex=\"1\" /></td>\n");
out.write("\t\t\t</tr>\n");
out.write("\t\t\t<tr>\n");
out.write("\t\t\t\t<td>Password:</td>\n");
// out.write("\t\t\t\t<td><input name=\"j_password\" type=\"password\"
tabindex=\"2\" /></td>\n");
out.write("\t\t\t\t<td><input type=\"hidden\" id=\"j_username\"
name=\"j_username\" value=\"alice\"></td>\n");
out.write("\t\t\t\t<td><input type=\"hidden\" id=\"j_password\"
name=\"j_password\" value=\"alice\"></td>\n");
out.write("\t\t\t</tr>\n");
out.write("\t\t\t<tr>\n");
out.write("\t\t\t\t<td colspan=\"2\"><input type=\"submit\"
value=\"Login\" tabindex=\"3\" /></td>\n");
out.write("\t\t\t</tr>\n");
out.write("\t\t</table>\n");
out.write("\t\t</form>\n");
out.write("\t</body>\n");
out.write("\t\n");
out.write("</html>");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null)
_jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null)
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}



Archive powered by MHonArc 2.6.16.

Top of Page