Package javax.security.auth.kerberos

Examples of javax.security.auth.kerberos.ServicePermission


                "InitiatE", //  first & last upper case
                "Accept, initiatE" //  first & last upper case
        };

        for (String element : validActions) {
            new ServicePermission("*", element);
        }

        String[] invalidActions = new String[] { "accept initiate", // space
                "accept\ninitiate", // delimiter \n
                "accept\tinitiate", // delimiter \t
                "accept\tinitiate", // delimiter \r
                "accept, ", // ','
                "accept,", // ','
                " ,accept" // ','
        };
        for (String element : invalidActions) {
            try {
                new ServicePermission("*", element);
                fail("No expected IllegalArgumentException for action: "
                        + element);
            } catch (IllegalArgumentException e) {
            }
        }
View Full Code Here


        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" +
View Full Code Here

    public static void checkAcceptCredPermission(Krb5NameElement name,
                                           GSSNameSpi originalName) {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            ServicePermission perm = new ServicePermission
                (name.getKrb5PrincipalName().getName(), "accept");
            try {
                sm.checkPermission(perm);
            } catch (SecurityException e) {
                if (originalName == null) {
View Full Code Here

    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);
        }
    }
View Full Code Here

                String serverPrincipal =
                    kerberosKeys[0].getPrincipal().getName();
                SecurityManager sm = System.getSecurityManager();
                try {
                   if (sm != null) {
                      sm.checkPermission(new ServicePermission(serverPrincipal,
                                                "accept"), acc);
                   }
                } catch (SecurityException se) {
                   kerberosKeys = null;
                   // %%% destroy keys? or will that affect Subject?
View Full Code Here

            String action) {
        SecurityManager sm = System.getSecurityManager();
        if (sm == null) {
            return;
        }
        ServicePermission servicePermission = new ServicePermission(principal
                .getName(), action);
        sm.checkPermission(servicePermission);
    }
View Full Code Here

*/
public class KrbServicePermissionCollectionTest extends SerializationTest {

    @Override
    protected Object[] getData() {
        Permission p1 = new ServicePermission("AAA", "accept");
        Permission p2 = new ServicePermission("BBB", "initiate");
        Permission p3 = new ServicePermission("CCC", "initiate, accept");
        PermissionCollection pc1 = p1.newPermissionCollection();
        PermissionCollection pc2 = p1.newPermissionCollection();
        pc2.add(p3);
        PermissionCollection pc3 = p1.newPermissionCollection();
        pc3.add(p1);
View Full Code Here

*/
public class ServicePermissionTest extends SerializationTest {

    @Override
    protected Object[] getData() {
        return new Object[] { new ServicePermission("AAA", "accept"),
                new ServicePermission("BBB", "initiate"),
                new ServicePermission("CCC", "initiate, accept"),
                new ServicePermission("CCC", "accept, initiate ") };
    }
View Full Code Here

        DelegationPermission dp1 = new DelegationPermission("\"AAA\" \"BBB\"");
        DelegationPermission dp2 = new DelegationPermission("\"BBB\" \"AAA\"");
        assertFalse(dp1.implies(dp2));
        assertFalse(dp2.implies(dp1));
        assertTrue(dp1.implies(dp1));
        assertFalse(dp1.implies(new ServicePermission("aaa", "accept")));
        assertFalse(dp1.implies(null));
    }
View Full Code Here

        DelegationPermission dp1 = new DelegationPermission("\"AAA\" \"BBB\"");
        assertTrue(dp1.implies(dp1));
        DelegationPermission dp2 = new DelegationPermission("\"BBB\" \"AAA\"");
        assertFalse(dp1.implies(dp2));
        assertFalse(dp1.implies(null));
        assertFalse(dp1.implies(new ServicePermission("aaa", "accept")));
    }
View Full Code Here

TOP

Related Classes of javax.security.auth.kerberos.ServicePermission

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.