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 Project: dragonwell8_jdk   Author: alibaba   File: Krb5MechFactory.java    License: 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 #2
Source Project: dragonwell8_jdk   Author: alibaba   File: Krb5MechFactory.java    License: 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 Project: dragonwell8_jdk   Author: alibaba   File: AcceptPermissions.java    License: 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 #4
Source Project: TencentKona-8   Author: Tencent   File: Krb5MechFactory.java    License: 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 #5
Source Project: TencentKona-8   Author: Tencent   File: Krb5MechFactory.java    License: 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 Project: TencentKona-8   Author: Tencent   File: AcceptPermissions.java    License: 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 #7
Source Project: jdk8u_jdk   Author: JetBrains   File: Krb5MechFactory.java    License: 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 #8
Source Project: jdk8u60   Author: chenghanpeng   File: Krb5MechFactory.java    License: 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 #9
Source Project: jdk8u60   Author: chenghanpeng   File: AcceptPermissions.java    License: 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 Project: jdk8u_jdk   Author: JetBrains   File: Krb5MechFactory.java    License: 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 Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: Krb5MechFactory.java    License: 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 #12
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: Krb5MechFactory.java    License: 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 #13
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: AcceptPermissions.java    License: 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 Project: openjdk-8   Author: bpupadhyaya   File: AcceptPermissions.java    License: 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 #15
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: Krb5MechFactory.java    License: 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 #16
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: AcceptPermissions.java    License: 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 #17
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Krb5MechFactory.java    License: 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 #18
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Krb5MechFactory.java    License: 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 #19
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: AcceptPermissions.java    License: 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 Project: openjdk-8   Author: bpupadhyaya   File: Krb5MechFactory.java    License: 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 #21
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: Krb5MechFactory.java    License: 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 #22
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: Krb5MechFactory.java    License: 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 #23
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: AcceptPermissions.java    License: 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 #24
Source Project: jdk8u_jdk   Author: JetBrains   File: AcceptPermissions.java    License: 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 #25
Source Project: hottub   Author: dsrg-uoft   File: Krb5MechFactory.java    License: 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 Project: hottub   Author: dsrg-uoft   File: AcceptPermissions.java    License: 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 #27
Source Project: openjdk-8-source   Author: keerath   File: Krb5MechFactory.java    License: 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 #28
Source Project: openjdk-8-source   Author: keerath   File: AcceptPermissions.java    License: 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 #29
Source Project: openjdk-8   Author: bpupadhyaya   File: AcceptPermissions.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static void initPerms(String... names) {
    perms.clear();
    for (String name: names) {
        perms.put(new ServicePermission(
                name + "@" + OneKDC.REALM, "accept"), "expected");
    }
}
 
Example #30
Source Project: dragonwell8_jdk   Author: alibaba   File: Krb5Util.java    License: GNU General Public License v2.0 5 votes vote down vote up
static void checkServicePermission(String target, String action) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        SunNativeProvider.debug("Checking ServicePermission(" +
                                target + ", " + action + ")");
        ServicePermission perm =
            new ServicePermission(target, action);
        sm.checkPermission(perm);
    }
}