Package javax.security.auth

Examples of javax.security.auth.PrivateCredentialPermission


  if (!(entryCs instanceof SubjectCodeSource))
      return false;


  PrivateCredentialPermission pcp = (PrivateCredentialPermission)p;
  SubjectCodeSource scs = (SubjectCodeSource)entryCs;

  // see if it is a SELF permission
  String[][] pPrincipals = pcp.getPrincipals();
  if (pPrincipals.length <= 0 ||
      !pPrincipals[0][0].equalsIgnoreCase("self") ||
      !pPrincipals[0][1].equalsIgnoreCase("self")) {

      // regular PrivateCredentialPermission
      return false;
  } else {

      // granted a SELF permission - create a
      // PrivateCredentialPermission for each
      // of the Policy entry's CodeSource Principals

      if (scs.getPrincipals() == null) {
    // XXX SubjectCodeSource has no Subject???
    return true;
      }

      ListIterator pli = scs.getPrincipals().listIterator();
      while (pli.hasNext()) {

    PolicyParser.PrincipalEntry principal =
        (PolicyParser.PrincipalEntry)pli.next();

    // XXX
    //  if the Policy entry's Principal does not contain a
    //    WILDCARD for the Principal name, then a
    //    new PrivateCredentialPermission is created
    //    for the Principal listed in the Policy entry.
    //  if the Policy entry's Principal contains a WILDCARD
    //    for the Principal name, then a new
    //    PrivateCredentialPermission is created
    //    for each Principal associated with the Subject
    //    in the current ACC.

    String[][] principalInfo = getPrincipalInfo
            (principal, accCs);

    for (int i = 0; i < principalInfo.length; i++) {

        // here's the new PrivateCredentialPermission

        PrivateCredentialPermission newPcp =
      new PrivateCredentialPermission
        (pcp.getCredentialClass() +
          " " +
          principalInfo[i][0] +
          " " +
          "\"" + principalInfo[i][1] + "\"",
        "read");

        if (debug != null) {
      debug.println("adding SELF permission: " +
          newPcp.toString());
        }

        perms.add(newPcp);
    }
      }
View Full Code Here


        add(new SerializablePermission("enableSubclassImplementation"));
        add(new RuntimePermission("reflectionFactoryAccess"));

        //by default allow the scripts access to any credentials of any user
        //we don't consider the scripts malevolent.
        add(new PrivateCredentialPermission("* * \"*\"", "read"));

        //adding this so that new classes with loggers can be initialized.
        add(new LoggingPermission("control", null));
    }
View Full Code Here

        if (!(entryCs instanceof SubjectCodeSource))
            return false;


        PrivateCredentialPermission pcp = (PrivateCredentialPermission)p;
        SubjectCodeSource scs = (SubjectCodeSource)entryCs;

        // see if it is a SELF permission
        String[][] pPrincipals = pcp.getPrincipals();
        if (pPrincipals.length <= 0 ||
            !pPrincipals[0][0].equalsIgnoreCase("self") ||
            !pPrincipals[0][1].equalsIgnoreCase("self")) {

            // regular PrivateCredentialPermission
            return false;
        } else {

            // granted a SELF permission - create a
            // PrivateCredentialPermission for each
            // of the Policy entry's CodeSource Principals

            if (scs.getPrincipals() == null) {
                // XXX SubjectCodeSource has no Subject???
                return true;
            }

            ListIterator<PolicyParser.PrincipalEntry> pli =
                                        scs.getPrincipals().listIterator();
            while (pli.hasNext()) {

                PolicyParser.PrincipalEntry principal = pli.next();

                // XXX
                //      if the Policy entry's Principal does not contain a
                //              WILDCARD for the Principal name, then a
                //              new PrivateCredentialPermission is created
                //              for the Principal listed in the Policy entry.
                //      if the Policy entry's Principal contains a WILDCARD
                //              for the Principal name, then a new
                //              PrivateCredentialPermission is created
                //              for each Principal associated with the Subject
                //              in the current ACC.

                String[][] principalInfo = getPrincipalInfo
                                                (principal, accCs);

                for (int i = 0; i < principalInfo.length; i++) {

                    // here's the new PrivateCredentialPermission

                    PrivateCredentialPermission newPcp =
                        new PrivateCredentialPermission
                                (pcp.getCredentialClass() +
                                        " " +
                                        principalInfo[i][0] +
                                        " " +
                                        "\"" + principalInfo[i][1] + "\"",
                                "read");

                    if (debug != null) {
                        debug.println("adding SELF permission: " +
                                        newPcp.toString());
                    }

                    perms.add(newPcp);
                }
            }
View Full Code Here

public class PrivateCredentialPermissionTest extends SerializationTest {

    @Override
    protected Object[] getData() {
        return new Object[] {new PrivateCredentialPermission("a.b.Cred a.c.Princ \"duke\"", "read")};
    }
View Full Code Here

        if (!(entryCs instanceof SubjectCodeSource))
            return false;


        PrivateCredentialPermission pcp = (PrivateCredentialPermission)p;
        SubjectCodeSource scs = (SubjectCodeSource)entryCs;

        // see if it is a SELF permission
        String[][] pPrincipals = pcp.getPrincipals();
        if (pPrincipals.length <= 0 ||
            !pPrincipals[0][0].equalsIgnoreCase("self") ||
            !pPrincipals[0][1].equalsIgnoreCase("self")) {

            // regular PrivateCredentialPermission
            return false;
        } else {

            // granted a SELF permission - create a
            // PrivateCredentialPermission for each
            // of the Policy entry's CodeSource Principals

            if (scs.getPrincipals() == null) {
                // XXX SubjectCodeSource has no Subject???
                return true;
            }

            ListIterator<PolicyParser.PrincipalEntry> pli =
                                        scs.getPrincipals().listIterator();
            while (pli.hasNext()) {

                PolicyParser.PrincipalEntry principal = pli.next();

                // XXX
                //      if the Policy entry's Principal does not contain a
                //              WILDCARD for the Principal name, then a
                //              new PrivateCredentialPermission is created
                //              for the Principal listed in the Policy entry.
                //      if the Policy entry's Principal contains a WILDCARD
                //              for the Principal name, then a new
                //              PrivateCredentialPermission is created
                //              for each Principal associated with the Subject
                //              in the current ACC.

                String[][] principalInfo = getPrincipalInfo
                                                (principal, accCs);

                for (int i = 0; i < principalInfo.length; i++) {

                    // here's the new PrivateCredentialPermission

                    PrivateCredentialPermission newPcp =
                        new PrivateCredentialPermission
                                (pcp.getCredentialClass() +
                                        " " +
                                        principalInfo[i][0] +
                                        " " +
                                        "\"" + principalInfo[i][1] + "\"",
                                "read");

                    if (debug != null) {
                        debug.println("adding SELF permission: " +
                                        newPcp.toString());
                    }

                    perms.add(newPcp);
                }
            }
View Full Code Here

public class PrivateCredentialPermissionTest extends SerializationTest {

    @Override
    protected Object[] getData() {
        return new Object[] {new PrivateCredentialPermission("a.b.Cred a.c.Princ \"duke\"", "read")};
    }
View Full Code Here

import javax.security.auth.PrivateCredentialPermission;

public class EmptyName {
    public static void main(String[] args) throws Exception {
        try {
            PrivateCredentialPermission perm =
                        new PrivateCredentialPermission("", "read");
            throw new SecurityException("test 1 failed");
        } catch (IllegalArgumentException iae) {
            // good
        }
        try {
            PrivateCredentialPermission perm =
                        new PrivateCredentialPermission(null, "read");
            throw new SecurityException("test 2 failed");
        } catch (IllegalArgumentException iae) {
            // good
        }
        System.out.println("test passed");
View Full Code Here

TOP

Related Classes of javax.security.auth.PrivateCredentialPermission

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.