Package javax.security.auth

Examples of javax.security.auth.AuthPermission


        assertFalse(lookupAuthPermission(requests, otherPermName));
        //
        // now check whether 'other' was also checked
        //
        requests.clear();
        allowedPerms.add(new AuthPermission(dummyPermName));
        try {
            new LoginContext(dummyName);
            fail("must not pass here - 1.");
        } catch (LoginException _) {
            fail("no, no, no. Throw SecurityException instead");
View Full Code Here


     */
    static boolean canGetSubject() {
  try {
      SecurityManager sm = System.getSecurityManager();
      if (sm != null)
    sm.checkPermission(new AuthPermission("getSubject"));
      return true;
  } catch (SecurityException e) {
      return false;
  }
    }
View Full Code Here

    AuthenticationPermission authPerm =
        new AuthenticationPermission(
      Collections.singleton(serverEndpoint.getPrincipal()),
      null, "listen");
    this.permsToRunWith = new Permission[] {
        new AuthPermission("getSubject"),
        new SocketPermission("*:1024-", "accept,connect,listen"),
        authPerm};
      }

      if (constraints != null) {
View Full Code Here

        authPerm = new AuthenticationPermission(
      "javax.security.auth.kerberos.KerberosPrincipal \"*\"",
      "listen");
    }
    this.permsToRunWith = new Permission[] {
        new AuthPermission("doAs"),
        new AuthPermission("getSubject"),
        new SocketPermission("*:1024-", "accept,connect,listen"),
        authPerm};
      }
      this.returnErrMsg = returnErrMsg;
      this.UnsupportedConsErrMsg = UnsupportedConsErrMsg;
View Full Code Here

      Collections.singleton(serverPrincipal), null,
      "listen");
    this.permsToRunWith = new Permission[] {
        new SocketPermission("*:1024-", "accept,connect,listen"),
        authPerm,
        new AuthPermission("doAs"),
        new RuntimePermission("modifyThread"),
        new RuntimePermission("modifyThreadGroup"),
        new RuntimePermission("setContextClassLoader"),
        new ServicePermission(serverPrincipal.getName(), "accept")
    };
View Full Code Here

      TestPrincipal.class.getName() + " \"peer\"";
  String actions = "listen, accept, delegate";
  defaultPermsNoSocketPerm = new Permission[] {
      new TestPermission("testPermission"),
      new AuthenticationPermission(name, actions),
      new AuthPermission("doAs"), // needed for newRequest()
      // so provider will throw detailed exception instead of generic one
      new AuthPermission("getSubject")
  };
  defaultPermsWithSocketPerm = new Permission[] {
      new TestPermission("testPermission"),
      new AuthenticationPermission(name, actions),
      new AuthPermission("doAs"), // needed for newRequest()
      // so provider will throw detailed exception instead of generic one
      new AuthPermission("getSubject"),
      new SocketPermission("*:1024-", "accept,connect,listen")
  };
  rand = new Random();
  nextID = 1; // id starts from 1

View Full Code Here

  byte[] oneLongArray4 = getBytes(20000);
  byte[][] multiLongArray1 = getBytes(65, 1000);
  byte[][] multiLongArray2 = getBytes(90, 1000);

  Permission[] permsNoAuth = new Permission[] {
      new AuthPermission("doAs"),
      new AuthPermission("getSubject"),
      new SocketPermission("*:1024-", "accept,connect,listen"),
  };

  Permission[] sockPermOnly = new Permission[] {
      new SocketPermission("*:1024-", "accept,connect,listen"),
View Full Code Here

  @Test
  public void testTrustedExecution() throws Exception {
    beanFactory.setSecurityContextProvider(null);

    Permissions perms = new Permissions();
    perms.add(new AuthPermission("getSubject"));
    ProtectionDomain pd = new ProtectionDomain(null, perms);

    new AccessControlContext(new ProtectionDomain[] { pd });

    final Subject subject = new Subject();
View Full Code Here

  /**
   * Tests that setConfiguration() is properly secured via SecurityManager.
   */
  public void testSetConfiguration() {
        SecurityChecker checker = new SecurityChecker(new AuthPermission(
        "setLoginConfiguration"), true);
    System.setSecurityManager(checker);
    Configuration custom = new ConfTestProvider();
    Configuration.setConfiguration(custom);
    assertTrue(checker.checkAsserted);
View Full Code Here

  /**
   * Tests that getConfiguration() is properly secured via SecurityManager.
   */
  public void testGetConfiguration() {
    Configuration.setConfiguration(new ConfTestProvider());
        SecurityChecker checker = new SecurityChecker(new AuthPermission(
        "getLoginConfiguration"), true);
    System.setSecurityManager(checker);
    Configuration.getConfiguration();
    assertTrue(checker.checkAsserted);
    checker.reset();
View Full Code Here

TOP

Related Classes of javax.security.auth.AuthPermission

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.