Attribute Transferring
DominicChen
dominic.chen at morningstar.com
Wed Apr 24 01:29:33 EDT 2013
I have set up Shibboleth IdP and SP both working well for me, but the
questions are about the attribute transferring.
I have configured the LoginHandler with ExternalAuthn type as sollwoing
snippet:
<ph:LoginHandler xsi:type="ph:ExternalAuthn" externalAuthnPath="/signin.jsp"
supportsForcedAuthentication="true">
<ph:AuthenticationMethod>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</ph:AuthenticationMethod>
</ph:LoginHandler>
The code-behind servlet is com.ms.QuthServlet.java. In the post method of
this class, I retrieved user’s email and userId according to business logic.
In general, user has been authenticated successfully. Below are the post
method of the servlet class used to do test:
protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
String email=request.getParameter("email");
String pwd=request.getParameter("password");
boolean f=true;
if(f ){
request.setAttribute("forceAuthn", true);
request.setAttribute("isPassive", true);
Subject subj = new Subject();
Principal principal = new UsernamePrincipal(email);
subj.getPrincipals().add(principal);
long userid=retrieveUserIdWithEmail(email);
request.setAttribute(LoginHandler.PRINCIPAL_KEY, principal);
request.setAttribute(LoginHandler.PRINCIPAL_NAME_KEY,
"dominic");
request.setAttribute(LoginHandler.SUBJECT_KEY, subj);
request.setAttribute("authnMethod",
"urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport");
request.setAttribute("relyingParty",
"https://sp.csrdu.org/shibboleth");
AuthenticationEngine.returnToAuthenticationEngine(request,
response);
} else {
request.setAttribute("loginFailed", "true"); //
request.getRequestDispatcher("/signin.jsp").forward(request,
response);
}
}
I assume that when use connect to resource ms.resources.com/resource.jsp, SP
will redirect user to this signin.jsp configured in LoginHandler and the
doPost method of code-behind servlet class authenticates user successfully.
Here my question is that I want to transfer some attributes obtained in the
doPost method such as email and userId to the place where the resource.jsp
can get it.
Could you please tell how to achieve this purpose?
--
View this message in context: http://shibboleth.1660669.n2.nabble.com/Attribute-Transferring-tp7586377.html
Sent from the Shibboleth - Users mailing list archive at Nabble.com.
More information about the users
mailing list