RE: Slide and JBoss Authentication

2003-02-25 Thread Adam Booth
Hi James,

I haven't put the JBoss login module together yet but will be in the next week or so, 
whenever I get some time. I'll post when its ready so you can get a copy. If in the 
mean time anyone happens across one that is already done...

Cheers,
Adam

-Original Message-
From: James Higginbotham [mailto:[EMAIL PROTECTED]
Sent: 25 February 2003 00:30
To: Slide Users Mailing List; Adam Booth
Subject: RE: Slide and JBoss Authentication


Adam,

Did you ever compose that JBoss login module? Just wondering if someone
submitted one to you or if you composed one that you could share.. 

Thanks,
James

 -Original Message-
 From: Adam Booth [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, February 13, 2003 4:47 AM
 To: [EMAIL PROTECTED]
 Subject: Slide and JBoss Authentication
 
 
 Hi all,
 
 I'm in the process of deploying slide with JBoss 3.0 / Jetty 
 using realm authentication. I was wonder if anyone has 
 already done this and written the custom authentication class 
 needed. If so would it possible get a copy. Any assistance 
 would be greatly appreciated.
 
 Thanks
 
 Adam
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Slide and JBoss Authentication

2003-02-25 Thread James Higginbotham
Ok.. I needed it today, so I went ahead and wrote it and javadoc'ed its
use for those interested. Hopefully, the slide maintainers will change
the package to whatever they like, update the single javadoc like that
refs the package, and commit this into CVS. I built it against JBoss
3.0.4 but it should work for any 3.0.x and probably 3.2/4.0+ - AFAIK,
they aren't changing the security APIs on those trees. 

Slide maintainers - please let me know if there is a preferred way for
me to submit contribs in the future.. It's a small file, so I figured
attaching here would be ok for now.

Regards,
James

 -Original Message-
 From: Adam Booth [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, February 25, 2003 3:20 AM
 To: James Higginbotham; Slide Users Mailing List
 Subject: RE: Slide and JBoss Authentication
 
 
 Hi James,
 
 I haven't put the JBoss login module together yet but will be 
 in the next week or so, whenever I get some time. I'll post 
 when its ready so you can get a copy. If in the mean time 
 anyone happens across one that is already done...
 
 Cheers,
 Adam
 
 -Original Message-
 From: James Higginbotham [mailto:[EMAIL PROTECTED]
 Sent: 25 February 2003 00:30
 To: Slide Users Mailing List; Adam Booth
 Subject: RE: Slide and JBoss Authentication
 
 
 Adam,
 
 Did you ever compose that JBoss login module? Just wondering 
 if someone submitted one to you or if you composed one that 
 you could share.. 
 
 Thanks,
 James
 
  -Original Message-
  From: Adam Booth [mailto:[EMAIL PROTECTED]
  Sent: Thursday, February 13, 2003 4:47 AM
  To: [EMAIL PROTECTED]
  Subject: Slide and JBoss Authentication
  
  
  Hi all,
  
  I'm in the process of deploying slide with JBoss 3.0 / Jetty
  using realm authentication. I was wonder if anyone has 
  already done this and written the custom authentication class 
  needed. If so would it possible get a copy. Any assistance 
  would be greatly appreciated.
  
  Thanks
  
  Adam
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: Slide and JBoss Authentication

2003-02-25 Thread James Higginbotham
) {
e.printStackTrace();
return null;
}

String passwordValue = null;

try {

NodeRevisionDescriptors revisionDescriptors =
contentHelper.retrieve(slideToken, usersPath + / +
username);
NodeRevisionDescriptor revisionDescriptor =
contentHelper.retrieve(slideToken, revisionDescriptors);
NodeProperty password =
revisionDescriptor.getProperty
(password, NodeProperty.SLIDE_NAMESPACE);
if (password != null) {
passwordValue = (String) password.getValue();
}

} catch (SlideException e) {
// Whatever happens doesn't really matter
// The stack trace is displayed for now for debug purposes
log.debug(Caught during password fetch,e);
}

if (passwordValue == null) {
log.warn(User  + username
+  doesn't have his password property set : 
+ can't authenticate);
}

return passwordValue;
}

/**
 * Return an array of Groups that will be attached to the user's
Principal. JBoss
 * has a default 'Roles' group that is created with all of the
roles found for the 
 * user (usually the default Slide set of nobody and guest,
user, or root)
 * @see
org.jboss.security.auth.spi.AbstractServerLoginModule#getRoleSets()
 */
protected Group[] getRoleSets() throws LoginException
{
SimpleGroup rolesGroup = new SimpleGroup(Roles);
Group[] groups = new Group[1];
groups[0] = rolesGroup;

String username = getUsername();
Principal userPrincipal = getPrincipal(username);
CredentialsToken credToken = new
CredentialsToken(userPrincipal);
SlideToken slideToken = new SlideTokenImpl(credToken);
try {
Enumeration e =
securityHelper.getRoles(slideToken);
while(e.hasMoreElements())
{
// convert to an array
String role = (String)e.nextElement();
log.debug(Adding new SimplePrincipal with role=+role);
rolesGroup.addMember( new SimplePrincipal( role ) );
}
} catch (SlideException e) {
// The stack trace is displayed for now for debug purposes
e.printStackTrace();
log.debug(Caught during roles fetch,e);
}
return groups;
}

/**
 * Returns an internal slide principal for the given username
 * @param username
 * @return Principal
 */
private Principal getPrincipal(String username) 
{
return new SlideRealmPrincipal(username);
}

/**
 * Set of access tokens.
 */
private NamespaceAccessToken accessToken;
/**
 * Content helper.
 */
private Content contentHelper;
/**
 * Security halper.
 */
private Security securityHelper;
/**
 * Users path.
 */
private String usersPath;
/**
 * Root credentials token.
 */
private CredentialsToken rootCredentials;
/**
 * Namepsace to which this realm will connect.
 */
private String namespace;
/**
 * Static logger
 */
private static final Log log = LogFactory.getLog(
SlideLoginModule.class );;

}


/**
 * Private class representing an individual user's Principal object.
 */

final class SlideRealmPrincipal implements Principal 
{
/**
 * The username for this Principal.
 */
private String username = null;

/**
 * Construct a new MemoryRealmPrincipal instance.
 *
 * @param username The username for this Principal
 */
public SlideRealmPrincipal(String username) {

this.username = username;

}

/**
 * Return the name of this Principal.
 */
public String getName() {

return (username);

}
}


 -Original Message-
 From: James Higginbotham 
 Sent: Tuesday, February 25, 2003 8:31 PM
 To: Adam Booth; Slide Users Mailing List
 Subject: RE: Slide and JBoss Authentication
 
 
 Ok.. I needed it today, so I went ahead and wrote it and 
 javadoc'ed its use for those interested. Hopefully, the slide 
 maintainers will change the package to whatever they like, 
 update the single javadoc like that refs the package, and 
 commit this into CVS. I built it against JBoss 3.0.4 but it 
 should work for any 3.0.x and probably 3.2/4.0+ - AFAIK, they 
 aren't changing the security APIs on those trees. 
 
 Slide maintainers - please let me know if there is a 
 preferred way for me to submit contribs in the future.. It's 
 a small file, so I figured attaching here would be ok for now.
 
 Regards,
 James
 
  -Original Message-
  From: Adam Booth [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, February 25, 2003 3:20

RE: Slide and JBoss Authentication

2003-02-24 Thread James Higginbotham
Adam,

Did you ever compose that JBoss login module? Just wondering if someone
submitted one to you or if you composed one that you could share.. 

Thanks,
James

 -Original Message-
 From: Adam Booth [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, February 13, 2003 4:47 AM
 To: [EMAIL PROTECTED]
 Subject: Slide and JBoss Authentication
 
 
 Hi all,
 
 I'm in the process of deploying slide with JBoss 3.0 / Jetty 
 using realm authentication. I was wonder if anyone has 
 already done this and written the custom authentication class 
 needed. If so would it possible get a copy. Any assistance 
 would be greatly appreciated.
 
 Thanks
 
 Adam
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Slide and JBoss Authentication

2003-02-13 Thread Adam Booth
 Hi all,
 
 I'm in the process of deploying slide with JBoss 3.0 / Jetty using realm 
authentication. I was wonder if anyone has already done this and written the custom 
authentication class needed. If so would it possible get a copy. Any assistance would 
be greatly appreciated.
 
 Thanks
 
 Adam

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]