1 18 19 package org.apache.activemq.security; 20 21 import java.security.cert.X509Certificate ; 22 import java.util.Set ; 23 24 import javax.security.auth.Subject ; 25 26 31 public class JaasCertificateSecurityContext extends SecurityContext { 32 33 private Subject subject; 34 private X509Certificate [] certs; 35 36 public JaasCertificateSecurityContext(String userName, Subject subject, X509Certificate [] certs) { 37 super(userName); 38 this.subject = subject; 39 this.certs = certs; 40 } 41 42 public Set getPrincipals() { 43 return subject.getPrincipals(); 44 } 45 46 public String getUserName() { 47 if (certs != null && certs.length > 0) { 48 return certs[0].getSubjectDN().getName(); 49 } 50 return super.getUserName(); 51 } 52 53 } 54 | Popular Tags |