1   package jsdsi;
2   
3   /***
4    * Selects all authorization certificates issued by a specific principal
5    * that grant an authorization at least as strong as a specified
6    * authorization.
7    * 
8    * @author Sameer Ajmani
9    * @version $Revision: 1.2.6.1 $ $Date: 2005/11/08 03:12:52 $
10   */
11  public class AuthCertSelector extends CertSelector {
12      private final Principal issuer;
13      private final Auth auth;
14      
15      /***
16       * Creates an <code>AuthCertSelector</code> that matches
17       * all auth certs issued by <code>i</code>.
18       * 
19       * @param i the issuer to match
20       */
21      public AuthCertSelector(Principal i) {
22          this(i, Auth.NULL_AUTH);
23      }
24      
25      /***
26       * Creates an <code>AuthCertSelector</code> that matches
27       * these auth certs issued by <code>i</code> that grant
28       * an authorization no weaker than <code>a</code>
29       * 
30       * @param i the issuer to match
31       * @param a the weakest auth to match
32       */
33      public AuthCertSelector(Principal i, Auth a) {
34          issuer = i;
35          auth = a;
36      }
37      
38      /***
39       * @see java.lang.Object#clone()
40       */
41      public Object clone() {
42          return new AuthCertSelector(issuer, auth);
43      }
44      
45      /***
46       * @return true if cert's issuer is the same principal as
47       * this.issuer, and if cert's auth implies this.auth. 
48       * 
49       * @see java.security.cert.CertSelector#match(Certificate)
50       */
51      public boolean match(jsdsi.Certificate cert) {
52          return (cert.getCert() instanceof AuthCert)
53          && cert.getCert().getIssuer().samePrincipalAs(issuer)
54          && ((AuthCert)cert.getCert()).getAuth().implies(auth);
55      }
56      
57      /***
58       * @return issuer
59       */
60      public Principal getIssuer() {
61          return issuer;
62      }
63      
64      /***
65       * @return auth
66       */
67      public Auth getAuth() {
68          return auth;
69      }
70  }
This page was automatically generated by Maven