javax.security.auth.kerberos.ServicePermission Java Examples

The following examples show how to use javax.security.auth.kerberos.ServicePermission. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AcceptPermissions.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #2
Source File: Krb5MechFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #3
Source File: Krb5MechFactory.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #4
Source File: AcceptPermissions.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #5
Source File: Krb5MechFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #6
Source File: Krb5MechFactory.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void checkInitCredPermission(Krb5NameElement name) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        String realm = (name.getKrb5PrincipalName()).getRealmAsString();
        String tgsPrincipal =
            new String("krbtgt/" + realm + '@' + realm);
        ServicePermission perm =
            new ServicePermission(tgsPrincipal, "initiate");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (DEBUG) {
                System.out.println("Permission to initiate" +
                    "kerberos init credential" + e.getMessage());
            }
            throw e;
        }
    }
}
 
Example #7
Source File: AcceptPermissions.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #8
Source File: AcceptPermissions.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #9
Source File: AcceptPermissions.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #10
Source File: Krb5MechFactory.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #11
Source File: Krb5MechFactory.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #12
Source File: Krb5MechFactory.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void checkInitCredPermission(Krb5NameElement name) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        String realm = (name.getKrb5PrincipalName()).getRealmAsString();
        String tgsPrincipal =
            new String("krbtgt/" + realm + '@' + realm);
        ServicePermission perm =
            new ServicePermission(tgsPrincipal, "initiate");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (DEBUG) {
                System.out.println("Permission to initiate" +
                    "kerberos init credential" + e.getMessage());
            }
            throw e;
        }
    }
}
 
Example #13
Source File: AcceptPermissions.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #14
Source File: Krb5MechFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void checkInitCredPermission(Krb5NameElement name) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        String realm = (name.getKrb5PrincipalName()).getRealmAsString();
        String tgsPrincipal =
            new String("krbtgt/" + realm + '@' + realm);
        ServicePermission perm =
            new ServicePermission(tgsPrincipal, "initiate");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (DEBUG) {
                System.out.println("Permission to initiate" +
                    "kerberos init credential" + e.getMessage());
            }
            throw e;
        }
    }
}
 
Example #15
Source File: AcceptPermissions.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #16
Source File: Krb5MechFactory.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void checkInitCredPermission(Krb5NameElement name) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        String realm = (name.getKrb5PrincipalName()).getRealmAsString();
        String tgsPrincipal =
            new String("krbtgt/" + realm + '@' + realm);
        ServicePermission perm =
            new ServicePermission(tgsPrincipal, "initiate");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (DEBUG) {
                System.out.println("Permission to initiate" +
                    "kerberos init credential" + e.getMessage());
            }
            throw e;
        }
    }
}
 
Example #17
Source File: Krb5MechFactory.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #18
Source File: AcceptPermissions.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #19
Source File: AcceptPermissions.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #20
Source File: AcceptPermissions.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #21
Source File: Krb5MechFactory.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #22
Source File: Krb5MechFactory.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void checkInitCredPermission(Krb5NameElement name) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        String realm = (name.getKrb5PrincipalName()).getRealmAsString();
        String tgsPrincipal =
            new String("krbtgt/" + realm + '@' + realm);
        ServicePermission perm =
            new ServicePermission(tgsPrincipal, "initiate");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (DEBUG) {
                System.out.println("Permission to initiate" +
                    "kerberos init credential" + e.getMessage());
            }
            throw e;
        }
    }
}
 
Example #23
Source File: Krb5MechFactory.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #24
Source File: Krb5MechFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void checkInitCredPermission(Krb5NameElement name) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        String realm = (name.getKrb5PrincipalName()).getRealmAsString();
        String tgsPrincipal =
            new String("krbtgt/" + realm + '@' + realm);
        ServicePermission perm =
            new ServicePermission(tgsPrincipal, "initiate");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (DEBUG) {
                System.out.println("Permission to initiate" +
                    "kerberos init credential" + e.getMessage());
            }
            throw e;
        }
    }
}
 
Example #25
Source File: Krb5MechFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #26
Source File: Krb5MechFactory.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #27
Source File: AcceptPermissions.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission sp = (ServicePermission)perm;
    if (!sp.getActions().equals("accept")) {
        return;
    }
    // We only care about accept ServicePermission in this test
    try {
        super.checkPermission(sp);
    } catch (SecurityException se) {
        if (perms.containsKey(sp)) {
            perms.put(sp, "checked");
        } else {
            throw se;   // We didn't expect this is needed
        }
    }
}
 
Example #28
Source File: Krb5MechFactory.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void checkAcceptCredPermission(Krb5NameElement name,
                                       GSSNameSpi originalName) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null && name != null) {
        ServicePermission perm = new ServicePermission
            (name.getKrb5PrincipalName().getName(), "accept");
        try {
            sm.checkPermission(perm);
        } catch (SecurityException e) {
            if (originalName == null) {
                // Don't disclose the name of the principal
                e = new SecurityException("No permission to acquire "
                                  + "Kerberos accept credential");
                // Don't call e.initCause() with caught exception
            }
            throw e;
        }
    }
}
 
Example #29
Source File: Krb5Context.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkPermission(String principal, String action) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        ServicePermission perm =
            new ServicePermission(principal, action);
        sm.checkPermission(perm);
    }
}
 
Example #30
Source File: SSL.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void checkPermission(Permission perm) {
    if (!(perm instanceof ServicePermission)) {
        return;
    }
    ServicePermission p = (ServicePermission)perm;
    permChecks = permChecks + p.getActions().toUpperCase().charAt(0);
}