FileDocCategorySizeDatePackage
X509CertificateCredential.javaAPI DocGlassfish v2 API4394Fri May 04 22:35:26 BST 2007com.sun.enterprise.security.auth.login

X509CertificateCredential

public class X509CertificateCredential extends Object
This class holds the user certificate for the certificate realm and the realm name. This credential is added as a public credential to the JAAS subject.

Fields Summary
private X509Certificate[]
certChain
private String
realm
private String
alias
Constructors Summary
public X509CertificateCredential(X509Certificate[] certChain, String alias, String realm)
Construct a credential with the specified X509Certificate certificate chain, realm name and alias.

param
the X509Certificate.
param
the alias for the certificate
param
the realm name. The only value supported for now is "certificate".

	this.certChain = certChain;
	this.alias = alias;
	this.realm = realm;
    
Methods Summary
public booleanequals(java.lang.Object o)
Compare two instances of the credential and return true if they are the same and false otherwise.

return
true if the instances are equal, false otherwise.

	if(o instanceof X509CertificateCredential) {
	    X509CertificateCredential pc = (X509CertificateCredential) o;
	    if(pc.getRealm().equals(realm) && pc.getAlias().equals(alias)) {
		X509Certificate[] certs = pc.getX509CertificateChain();
		for(int i = 0; i < certs.length; i++) {
		    if(!certs[i].equals(certChain[i])) {
			return false;
		    }
		}
		return true;
	    }
	}
	return false;
    
public java.lang.StringgetAlias()
Return the alias for the certificate.

return
the alias.

	return alias;
    
public java.lang.StringgetRealm()
Return the realm name.

return
the realm name. Only value supported for now is "certificate".

	return realm;
    
public java.security.cert.X509Certificate[]getX509CertificateChain()
Return the chain of certificates.

return
the chain of X509Certificates.

	return certChain;
    
public inthashCode()
Return the hashCode computed from the certificate, realm and alias.

return
the hash code.

	return certChain.hashCode() + realm.hashCode() + alias.hashCode();
    
public java.lang.StringtoString()
String representation of the credential.

	String s = "Realm=" + realm;
	s = s + " alias=" + alias;
	s = s + " X509Certificate=" + certChain;
	return s;