Package java.security

Examples of java.security.Identity


    return permissionCollection;
  }

  boolean isTrusted() {
    Identity identities[] = codeSource.identities;

    boolean trusted = false;

    if(identities != null) {
      for(int i = 0; i < identities.length && !trusted; i++)
View Full Code Here


    this.zipEntry = zipEntry;
    this.jvs = jvs;
    }

    public Identity[] getIdentities() {
    Identity identities[] = null;

    if(jvs != null) {
      Class classes[] = new Class[1];
      classes[0] = String.class;
     
View Full Code Here

   * @tests java.security.IdentityScope#addIdentity(java.security.Identity)
   */
  public void test_addIdentityLjava_security_Identity() throws Exception {
           IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
               new IdentityScopeSubclass());
           Identity id = new IdentitySubclass("id1");
           id.setPublicKey(pubKey);
           sub.addIdentity(id);
           try {
             Identity id2 = new IdentitySubclass("id2");
             id2.setPublicKey(pubKey);
             sub.addIdentity(id2);
             fail("KeyManagementException should have been thrown");
           } catch (KeyManagementException e) {
             // Expected
           }
View Full Code Here

   * @tests java.security.IdentityScope#removeIdentity(java.security.Identity)
   */
  public void test_removeIdentityLjava_security_Identity() throws Exception {
           IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
               new IdentityScopeSubclass());
           Identity id = new IdentitySubclass();
           id.setPublicKey(pubKey);
           sub.addIdentity(id);
           sub.removeIdentity(id);
           try {
             sub.removeIdentity(id);
             fail("KeyManagementException should have been thrown");
View Full Code Here

   * @tests java.security.IdentityScope#identities()
   */
  public void test_identities() throws Exception {
           IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
               new IdentityScopeSubclass());
           Identity id = new IdentitySubclass();
           id.setPublicKey(pubKey);
           sub.addIdentity(id);
           Enumeration en = sub.identities();
           assertTrue("Wrong object contained in identities", en.nextElement()
               .equals(id));
           assertTrue("Contains too many elements", !en.hasMoreElements());
View Full Code Here

  /**
   * @tests java.security.IdentityScope#getIdentity(java.security.Principal)
   */
  public void test_getIdentityLjava_security_Principal() throws Exception {
           Identity id = new IdentitySubclass("principal name");
           id.setPublicKey(pubKey);
           IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
               new IdentityScopeSubclass());
           sub.addIdentity(id);
           Identity returnedId = sub.getIdentity(id);
           assertEquals("Returned Identity not the same as the added one", id,
               returnedId);
  }
View Full Code Here

   * @tests java.security.IdentityScope#getIdentity(java.security.PublicKey)
   */
  public void test_getIdentityLjava_security_PublicKey() throws Exception {
           IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
               new IdentityScopeSubclass());
           Identity id = new IdentitySubclass();
           id.setPublicKey(pubKey);
           sub.addIdentity(id);
           Identity returnedId = sub.getIdentity(pubKey);
           assertEquals("Returned Identity not the same as the added one", id,
               returnedId);
  }
View Full Code Here

   * @tests java.security.IdentityScope#getIdentity(java.lang.String)
   */
  public void test_getIdentityLjava_lang_String() throws Exception {
           IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
               new IdentityScopeSubclass());
           Identity id = new IdentitySubclass("test");
           id.setPublicKey(pubKey);
           sub.addIdentity(id);
           Identity returnedId = sub.getIdentity("test");
           assertEquals("Returned Identity not the same as the added one", id,
               returnedId);
  }
View Full Code Here

   * @tests java.security.IdentityScope#size()
   */
  public void test_size() throws Exception {
           IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
               new IdentityScopeSubclass());
           Identity id = new IdentitySubclass();
           id.setPublicKey(pubKey);
           sub.addIdentity(id);
           assertEquals("Wrong size", 1, sub.size());
  }
View Full Code Here

     * @tests java.security.IdentityScope#toString()
     */
    public void test_toString() throws Exception {
            IdentityScopeSubclass sub = new IdentityScopeSubclass("test",
                    new IdentityScopeSubclass());
            Identity id = new IdentitySubclass();
            id.setPublicKey(pubKey);
            sub.addIdentity(id);
            assertNotNull("toString returned a null", sub.toString());
            assertTrue("Not a valid String ", sub.toString().length() > 0);
    }
View Full Code Here

TOP

Related Classes of java.security.Identity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.