any advice on how to modify the login.jsp page?

Wang, Holly holly.wang at csun.edu
Thu Apr 19 20:06:01 BST 2012


Hi,

Thank you for your advice, Karla.

I finally got it work by insert some code at the login.jsp page. The basic idea still is keep the current login form, then display another form based on the loginContext.getRelyingPartyId()

Here is my code to add in the login.jsp

<%@ page import="edu.internet2.middleware.shibboleth.idp.util.HttpServletHelper" %>
<%@ page import="org.opensaml.util.storage.StorageService" %>
<%@ page import="edu.internet2.middleware.shibboleth.idp.authn.LoginContext" %>
<%@ page import = "java.util.*" %>

<%
                   if (loginContext!=null){
                     if(loginContext.getRelyingPartyId()!=null ){
                       if(loginContext.getRelyingPartyId().equals("http://your log in site") ){
                                        %>

Then display another form with action post to another site



Many thanks for your help. Hope my case help others too


Holly Wang, IT Department  CSUN, 818-677-2031

From: users-bounces at shibboleth.net [mailto:users-bounces at shibboleth.net] On Behalf Of Karla Borecky
Sent: Tuesday, April 17, 2012 11:57 AM
To: Shib Users
Subject: Re: any advice on how to modify the login.jsp page?

I think the code that processes this decision needs to be on the Moodle side. I believe you can set up a chaining authentication in moodle... or maybe just a button for 'local authentication'?
On Tue, Apr 17, 2012 at 1:18 PM, Wang, Holly <holly.wang at csun.edu<mailto:holly.wang at csun.edu>> wrote:
We have three kind of users, regular user log in through shibboleth, and moodle admin/guest will be just direct to moodle website for them to log in.

I am thinking weather the login page can see which website the user is logged in, then display different form based on the source. Do you think following code will work?

StorageService storageService = HttpServletHelper.getStorageService(application);
LoginContext loginContext = HttpServletHelper.getLoginContext(storageService,application, request);
String entityId = loginContext.getRelyingPartyId();
if (loginContext.getRelyingPartyId().equals("http://moodle.net")){

then display a different html form here

else{

the default html login form here



Holly Wang, IT Department  CSUN, 818-677-2031<tel:818-677-2031>

From: users-bounces at shibboleth.net<mailto:users-bounces at shibboleth.net> [mailto:users-bounces at shibboleth.net<mailto:users-bounces at shibboleth.net>] On Behalf Of Karla Borecky
Sent: Tuesday, April 17, 2012 10:14 AM
To: Shib Users
Subject: Re: any advice on how to modify the login.jsp page?

Holly, could you possibly branch the behavior based on an attribute (after the authentication)? or is this something that has to happen to actually process the login in different ways?
On Mon, Apr 16, 2012 at 4:31 PM, Wang, Holly <holly.wang at csun.edu<mailto:holly.wang at csun.edu>> wrote:
Hi,

I am asked to modify shib login.jsp page so the form with take multiple submit command. Depending on the submit button value, we send the form to different places.

I did some testing, tried to add a new jsp page to handle it. But I can't find a place to define the servlet definition for the new jsp page.

Does anyone has an example on the login.jsp which takes multiple submit commend?

Current login.jsp form:

<form action="j_security_check" method="post" autocomplete="off">
<input type="text" id="uid" name="j_username" style="width:100px" value=""/>
<input type="password" name="j_password" style="width:100px"/>
<input type="submit" value="Login" />
</form>


We want it to be like following, but action lead to different places per the submit value:

<form action=" "  method="post" autocomplete="off">
<input type="text" id="uid" name="j_username" style="width:100px" value=""/>
<input type="password" name="j_password" style="width:100px"/>
<input type="submit" value="Login" />
<input value="moodleadmin" type="submit" name="moodleadmin" id="moodleadmin">
</form>

thanks

Holly Wang, IT Department  CSUN, 818-677-2031<tel:818-677-2031>

--
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net<mailto:users-unsubscribe at shibboleth.net>



--
Karla Borecky
Systems Administrator
ITS
Smith College
Northampton, MA 01063


--
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net<mailto:users-unsubscribe at shibboleth.net>



--
Karla Borecky
Systems Administrator
ITS
Smith College
Northampton, MA 01063

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/users/attachments/20120419/b90d382d/attachment-0001.html 


More information about the users mailing list