FileDocCategorySizeDatePackage
JmsCred.javaAPI DocJBoss 4.2.13873Fri Jul 13 21:01:16 BST 2007org.jboss.resource.adapter.jms

JmsCred

public class JmsCred extends Object
Credential information
author
Peter Antman .
author
Adrian Brock
version
$Revision: 57189 $

Fields Summary
public String
name
public String
pwd
Constructors Summary
public JmsCred()

		// empty
	
Methods Summary
public static org.jboss.resource.adapter.jms.JmsCredgetJmsCred(javax.resource.spi.ManagedConnectionFactory mcf, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo info)
Get our own simple cred

		JmsCred jc = new JmsCred();
		if (subject == null && info != null)
		{
			// Credentials specifyed on connection request
			jc.name = ((JmsConnectionRequestInfo) info).getUserName();
			jc.pwd = ((JmsConnectionRequestInfo) info).getPassword();
		}
		else if (subject != null)
		{
			// Credentials from appserver
			PasswordCredential pwdc = GetCredentialAction.getCredential(subject, mcf);
			if (pwdc == null)
			{
				// No hit - we do need creds
				throw new SecurityException("No Password credentials found");
			}
			jc.name = pwdc.getUserName();
			jc.pwd = new String(pwdc.getPassword());
		}
		else
		{
			throw new SecurityException("No Subject or ConnectionRequestInfo set, could not get credentials");
		}
		return jc;
	
public java.lang.StringtoString()

		return super.toString() + "{ username=" + name + ", password=**** }";