[jboss-dev-forums] [Design of Security on JBoss] - Re: Security Client SPI

anil.saldhana@jboss.com do-not-reply at jboss.com
Wed May 2 11:50:25 EDT 2007


I have checked in the SPI for the client.  Here is a test case in AS5 that tests the security client for simple/jaas.  SASL implementation will be done in securirty 2.0.1 or later.

http://anonsvn.jboss.org/repos/jbossas/trunk/testsuite/src/main/org/jboss/test/security/test/client/SecurityClientUnitTestCase.java

Here is the SPI for you:

  | public abstract class SecurityClient
  | {
  |  public void login() throws LoginException
  |  public void logout()
  |  public void setSimple(Object username, Object credential)
  |  public void setJAAS(String configName, CallbackHandler cbh)
  |  public void setSASL(String mechanism, String authorizationId,
  |          CallbackHandler cbh)
  | }
  | 

How does one get hold of the security client? Here are possible ways:

  | //Get the default
  | SecurityClient sc = null;
  |       sc = SecurityClientFactory.getSecurityClient();
  |       assertNotNull("SecurityClient != null",sc);
  | 
  | //Pass in a FQN
  |       sc = SecurityClientFactory.getSecurityClient("org.jboss.security.client.JBossSecurityClient");
  |       assertNotNull("SecurityClient != null",sc);
  |       
  | //Pass in a Class object whose instances are needed (Not big fan of this method)
  | sc = SecurityClientFactory.getSecurityClient(JBossSecurityClient.class);
  |       assertNotNull("SecurityClient != null",sc);
  | 

Hopefully now your integration tests do not have to do SecurityAssociation.setPrincipal and SecurityAssociation.setCredential


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042492



More information about the jboss-dev-forums mailing list