Thanks for your continuing suggestions and patience, Shane.

I reimplemented  by overriding getLoginContext() and it's still going boom.

here's my JAAS config factory method:

  | @Factory(value="org.jboss.seam.security.configuration", autoCreate=true, 
scope=APPLICATION)
  |    public javax.security.auth.login.Configuration getConfiguration()
  |    {
  |        log.error("in my getConfiguration()");
  |       return new javax.security.auth.login.Configuration()
  |       {
  |            
  |          private AppConfigurationEntry[] aces = { new 
AppConfigurationEntry( 
  |             X500LoginModule.class.getName(), 
  |             LoginModuleControlFlag.REQUIRED, 
  |             new HashMap<String,String>() 
  |          ) };
  |          
  |          @Override
  |          public AppConfigurationEntry[] getAppConfigurationEntry(String 
name)
  |          {
  |             List<AppConfigurationEntry> entries = new 
ArrayList<AppConfigurationEntry>();
  |             for( AppConfigurationEntry entry : aces)
  |             {
  |                 if( entry.getLoginModuleName().equals(name))
  |                     entries.add(entry);
  |                     
  |             }
  |             return entries.toArray(new AppConfigurationEntry[0]);
  |          }
  |          
  |          
  |          public String toString()
  |          {
  |             return "appConfigurationEntries="+Arrays.asList(aces);
  |          }
  |          
  |          
  |       };
  |    }
  | 

And my subclass of identity

  | @Name(value = "org.jboss.seam.security.identity")
  | @Scope(value = SESSION)
  | //@BypassInterceptors
  | @Startup
  | public class X500Identity extends Identity {
  | 
  |     private static final LogProvider log = 
Logging.getLogProvider(X500Identity.class);
  | 
  |     @In(value="org.jboss.seam.security.configuration")
  |     Configuration config;
  | 
  |     @In(value="org.jboss.seam.core.expressions")
  |     Expressions expressionFactory;
  | 
  |     public X500Identity()
  |     {
  |         setJaasConfigName(X500LoginModule.class.getName());
  |         setAuthenticateEveryRequest(true);
  |         log.error("in X500Identity constructor.  jaas config name = 
"+this.getJaasConfigName());
  |     }
  |     @Override
  |     protected LoginContext getLoginContext() throws LoginException {
  |         log.error("in my getLoginContext()");
  |         
  |         if (getJaasConfigName() == null) {
  |             throw new RuntimeException("In X500Identity.  JAAS config name 
not set.  Please set it up.");
  |         }
  |         if( config == null )
  |             throw new RuntimeException("In X500Identity.  
\"org.jboss.seam.security.configuration\" component not injected.  Please set 
it up.");
  | 
  |             log.error( "new LoginContext(getJaasConfigName(), getSubject(), 
getDefaultCallbackHandler(), config)=+new 
LoginContext("+getJaasConfigName()+","+ getSubject()+","+ 
getDefaultCallbackHandler()+","+ config+")");
  |         return new LoginContext(getJaasConfigName(), getSubject(), 
getDefaultCallbackHandler(), config);
  |     }
  | 
  |     @Override
  |     public CallbackHandler getDefaultCallbackHandler() {
  |         log.error("in my getDefaultCallbackHandler()");
  |         return new CookieCallbackHandler();
  |     }
  | 
  | 
  | 
  |     @Override
  |     public void checkRestriction(String expr) {
  |         log.error("in my checkRestriction(String expr) expr=" + expr);
  |         if (!evaluateExpression(expr)) {
  |             if (!isLoggedIn()) {
  |                 this.login();
  |             } else {
  |                 
Events.instance().raiseEvent("org.jboss.seam.notAuthorized");
  |                 throw new 
AuthorizationException(String.format("Authorization check failed for expression 
[%s]", expr));
  |             }
  |         }
  |     }
  | 
  |     @Override
  |     public boolean isLoggedIn(boolean attemptLogin) {
  |         log.error("in my isLoggedIn(boolean attemptLogin) attemptLogin = " 
+ attemptLogin);
  |         boolean isLoggedIn = super.isLoggedIn(attemptLogin);
  |         log.error("exiting isLoggedIn(boolean attemptLogin).  isLoggedIn = 
" + isLoggedIn);
  |         return isLoggedIn;
  |     }
  | 
  |     @Override
  |     public Expressions.MethodExpression getAuthenticateMethod() {
  |         log.error("in my 
getAuthenticateMethod():"+expressionFactory.createMethodExpression("#{authBean.authenticate()}"));
  |         return 
expressionFactory.createMethodExpression("#{authBean.authenticate()}");
  |     }
  | 
  | 
  |     public static Identity instance() {
  |         if (!Contexts.isSessionContextActive()) {
  |             throw new IllegalStateException("No active session context");
  |         }
  | 
  |         Identity instance = (Identity) 
Component.getInstance(X500Identity.class, ScopeType.SESSION);
  | 
  |         if (instance == null) {
  |             throw new IllegalStateException("No Identity could be created");
  |         }
  | 
  |         return instance;
  |     }
  | }
  | 

For some reason, it doesn't appear to be hitting my authenticateMethod 
anymore....ideas?



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068365#4068365

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068365
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to