[JBoss Seam] - Identity not created
by monkeyden
I'm attempting to override Identity to add some logic specific to our application. Namely:
We're are replacing an old application and need check the previous applications login cookie value when the Seam cookie isn't found.
We need the getLoginFailedMessageSeverity() to return SEVERITY_ERROR instead of SEVERITY_INFO.
And a couple other little things.
But when I use @In Identity identity, elsewhere in my application, it's always null. What else do I need to do to get Seam to recognize it? Do I need to specify @AutoCreate? An instance() method in the subclass?
@Name("org.jboss.seam.security.identity")
| @Scope(ScopeType.SESSION)
| @Intercept(InterceptionType.AFTER_RESTORE_VIEW)
| @Startup
| @Install(precedence=11) //Used 11 to override RuleBasedIdentity
| public class Identity extends org.jboss.seam.security.Identity {
|
| private static final LogProvider log = Logging.getLogProvider(Identity.class);
|
| @Override
| protected Severity getLoginFailedMessageSeverity() {
| return FacesMessage.SEVERITY_ERROR;
| }
|
| protected String getLegacyCookieName() {
| return "userCookie";
| }
|
| @Override
| protected Cookie getCookie() {
| FacesContext ctx = FacesContext.getCurrentInstance();
| if (ctx != null) {
| Cookie cookie = (Cookie) ctx.
| getExternalContext().getRequestCookieMap().get(getCookieName());
| return cookie != null ? cookie : getLegacyCookie();
| } else {
| return null;
| }
| }
|
| protected Cookie getLegacyCookie() {
| log.debug("NEM4 Cookie not found. Attempting to load legacy cookie.");
| FacesContext ctx = FacesContext.getCurrentInstance();
| return (Cookie) ctx.getExternalContext().getRequestCookieMap().get(getLegacyCookieName());
| }
|
| public void create() {
| super.create();
| log.debug("Creating custom Identity.");
| }
|
| @Override
| protected String getLoginFailedMessageKey() {
| log.debug("Retrieving login failed message.");
| return "login.error.userNamePassword";
| }
| }
|
What am I doing wrong? Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065657#4065657
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065657
18Â years, 11Â months
[JBossWS] - Re: WS-Security client?
by kadlecp
Hello, my WS-Security client looks like this. It works.
public class TestClient {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
BasicConfigurator.configure();
System.setProperty("org.jboss.ws.wsse.keyStore", "resources/wsse.keystore");
System.setProperty("org.jboss.ws.wsse.trustStore", "resources/wsse.keystore");
System.setProperty("org.jboss.ws.wsse.keyStorePassword", "jbossws");
System.setProperty("org.jboss.ws.wsse.trustStorePassword", "jbossws");
System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");
System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");
URL wsdlFileURL = new URL("http://localhost:8080/simpleencrypt?wsdl");
QName qname = new QName("http://org.jboss.ws/samples/wssecurity", "HelloService");
URL securityURL = new File("resources/jboss-wsse-client.xml").toURI().toURL();
Service service = Service.create(wsdlFileURL, qname);
((ServiceExt)service).setSecurityConfig(securityURL.toExternalForm());
Hello port = service.getPort(Hello.class);
((StubExt)port).setConfigName("Standard WSSecurity Client");
String ret = port.echoUserType("hello world!");
System.out.println(ret);
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065656#4065656
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065656
18Â years, 11Â months