[JBoss Seam] - Security: Better support for single sign on?!
by stephen.friedrich
I need to integrate my seam app with an existing custom made SSO solution.
After some trial and error I came up with this solution that is basically working, even with login redirection configured (using redirect.captureCurrentView/returnToCapturedView exactly like documented in the seam reference).
| @Name("authenticator")
| @Scope(ScopeType.CONVERSATION)
| public class Authenticator {
| @In
| private Identity identity;
|
| private UserData userData;
|
| // This method is configured in pages.xml as an action called for all pages:
| // <page view-id="/*" login-required="true" action="#{authenticator.checkLogin}"/>
| public void checkLogin() {
| // if already logged on, simply continue
| if (identity.isLoggedIn()) {
| return;
| }
|
| // try SSO auto login
| HttpServletRequest request = FacesUtil.getServletRequest();
| userData = new SsoAuthenticator().validateSsoToken(request); // results in a web service call
| if(userData != null) {
| identity.login(); // Don't know another, more direct way to login, so store
| // userData in field and check it in the authenticate method
| }
| }
|
| // This method is configured in components.xml to as the identity's authenticate-method:
| // <security:identity authenticate-method="#{authenticator.authenticate}"/>
| public boolean authenticate() {
| if (userData != null) {
| // previously a sso token has been validated - log in automatically
| userData = null;
| return true;
| }
|
| String userName = Identity.instance().getUsername();
| String password = Identity.instance().getPassword();
| userData = new SsoAuthenticator().login(userName, password); // results in a web service call
|
| if (userData == null) {
| FacesMessages.instance().add("Invalid username/password");
| return false;
| }
|
| return true;
| }
| }
|
Small problem: After a successful sso auto login the next page displays
anonymous wrote : Warning
|
| 1. Please log in first
| 2. Welcome, Stephen
How can I prevent these messages or clear them afterwards?
Open issue:
If the user hit the login page directly (as opposed to being redirected when trying to access another page) I'd like to redirect after the login to different pages depending on the user's roles.
Any suggestions?
Proposal: Here's a way to make integration into an SSO solution easier:
Add an attribute to identity that lets me specify a method that is used to try auto-login:
| <security:identity authenticate-method="#{authenticator.authenticate}" auto-login-method="#{authenticator.tryAutoLogin}"/>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086376#4086376
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086376
18 years, 10 months
[EJB 3.0] - Incrementing thread counter using MDB's ?
by nkhadakk
JBoss 4.2.1/ JBM 1.3 GA
NOTE: I have mistakenly posted the same question in the JBM forum.I guess this belongs in this forum. Not an intentional double post.
We use MDBs running as endpoints for JMS messages. Running a load test on our code, here is a sample of logs that i see on the JBoss AS.
|
| com/favicon.ico|resolved:true|recommended:true|lastupdatedtime:0
| 16:11:36,079 DEBUG [WorkManager(2)-
| 1675]:
| org.jboss.jms.server.endpoint.ServerConnectionEndpoint - Connection 2736 stopped
| 16:11:36,079 DEBUG [WorkManager(2)-1675]: org.jboss.jms.server.endpoint.ServerConnectionEndpoint -
| Connection 2736 stopped
| 16:11:36,091 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.ejbs.UriMDB - JMS URL
| ::http://wwwapps.ups.com/WebTracking/track
| 16:11:36,092 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.ejbs.UriValidator - U
| riValidator::http://wwwapps.ups.com/WebTracking/track
| 16:11:36,092 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.ejbs.UriValidator - R
| unning HTML parser
| 16:11:36,093 DEBUG [WorkManager(2)-1676]: com.getmedium.services.urivalidation.HtmlParser - resolvi
| ng {}http://wwwapps.ups.com/WebTracking/track
| 16:11:36,108 INFO [WorkManager(2)-1674]: com.getmedium.services.urivalidation.HtmlParser - Resolvin
| g URL::http://www.datingnetwork.com
| 16:11:36,109 INFO [WorkManager(2)-1674]: com.getmedium.services.urivalidation.HtmlParser - URL isRe
| solved::true
| 16:11:36,109 INFO [WorkManager(2)-1674]: com.getmedium.services.urivalidation.HtmlParser - Found a
| title Token
| 16:11:36,301 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.HtmlParser - Resolvin
| g URL::http://wwwapps.ups.com/WebTracking/track
| 16:11:36,301 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.HtmlParser - URL isRe
| solved::true
| 16:11:36,305 INFO [WorkManager(2)-1676]: com.getmedium.se
|
|
The section of the log with this expression :
[WorkManager(2)-1676] bothers me. the number you see 1676 started from 0. This number keeps incrementing as the load test progresses. The log messages are coming from the MDB.
My reading of this display is that this log line is generated by the Thread#1676 in Thread group WorkManager(2).
Is this right ? Should the thread count continue to increment ?If pooling ...i would expect to see these numbers being re-used. Is this number increment symptomatic of misconfiguration on my part ? I have not profiled the server yet.
The server has not crashed . Yet :))
Here is my Log4J pattern :
| log4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} %p %x [%t]: %c - %m%n
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086370#4086370
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086370
18 years, 10 months
[JBoss Seam] - Re: JBoss EL performance vs Sun EL
by gavin.king@jboss.com
anonymous wrote : 1) In JSF for N mutually exclusive 'rendered' conditions they will ALWAYS be evaluated N times!!!
Well, sure.
But note that a switch statement is also involves n potential evaluations. I'm not sure what the difference is? I guess you can emulate a switch using nested f:subviews.
If this particular issue is truly a problem, it is possible to decide which fragment to render in your Java code by using rendered="false" on all N fragments and calling UIComponent.setRendered(true) explicitly before the render phase.
anonymous wrote : 2) Even worse there is no syntax to assign columnBean.type to a variable so it will be EVALUATED EACH TIME!!!
In components.xml, type:
<factory name="columnBeanType" scope="request" value="#{columnBean.type}"/>
Perhaps that "trick" addresses your concerns?
anonymous wrote : 3) Even worse it will be evaluated using REFLECTION!!!
It has been a really long time since a reflective method invocation was significantly slower than a normal method call. This seems to be a red herring.
anonymous wrote : 4) JSF will give you temptation to write condition as STRING comparison
I don't know what you mean.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086368#4086368
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086368
18 years, 10 months
[JBoss Messaging] - Incrementing thread counter using MDB's ?
by nkhadakk
JBoss 4.2.1/ JBM 1.3 GA
We use MDBs running as endpoints for JMS messages. Running a load test on our code, here is a sample of logs that i see on the JBoss AS.
com/favicon.ico|resolved:true|recommended:true|lastupdatedtime:0
| 16:11:36,079 DEBUG [WorkManager(2)-1675]: org.jboss.jms.server.endpoint.ServerConnectionEndpoint - Connection 2736 stopped
| 16:11:36,079 DEBUG [WorkManager(2)-1675]: org.jboss.jms.server.endpoint.ServerConnectionEndpoint - Connection 2736 stopped
| 16:11:36,091 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.ejbs.UriMDB - JMS URL::http://wwwapps.ups.com/WebTracking/track
| 16:11:36,092 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.ejbs.UriValidator - UriValidator::http://wwwapps.ups.com/WebTracking/track
| 16:11:36,092 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.ejbs.UriValidator - Running HTML parser
| 16:11:36,093 DEBUG [WorkManager(2)-1676]: com.getmedium.services.urivalidation.HtmlParser - resolving {}http://wwwapps.ups.com/WebTracking/track
| 16:11:36,108 INFO [WorkManager(2)-1674]: com.getmedium.services.urivalidation.HtmlParser - Resolving URL::http://www.datingnetwork.com
| 16:11:36,109 INFO [WorkManager(2)-1674]: com.getmedium.services.urivalidation.HtmlParser - URL isResolved::true
| 16:11:36,109 INFO [WorkManager(2)-1674]: com.getmedium.services.urivalidation.HtmlParser - Found a title Token
| 16:11:36,301 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.HtmlParser - Resolving URL::http://wwwapps.ups.com/WebTracking/track
| 16:11:36,301 INFO [WorkManager(2)-1676]: com.getmedium.services.urivalidation.HtmlParser - URL isResolved::true
| 16:11:36,305 INFO [WorkManager(2)-1676]: com.getmedium.se
The section of the log with this expression :
[WorkManager(2)-1676] bothers me. the number you see 1676 started from 0. This number keeps incrementing as the load test progresses. The log messages are coming from the MDB.
My reading of this display is that this log line is generated by the Thread#1676 in Thread group WorkManager(2).
Is this right ? Should the thread count continue to increment ?If pooling ...i would expect to see these numbers being re-used. Is this number increment symptomatic of misconfiguration on my part ? I have not profiled the server yet.
The server has not crashed . Yet :))
Here is my Log4J pattern :
log4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} %p %x [%t]: %c - %m%n
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086365#4086365
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086365
18 years, 10 months