Package javax.security.auth

Examples of javax.security.auth.AuthPermission


     */
    public synchronized void refresh() {

        java.lang.SecurityManager sm = System.getSecurityManager();
        if (sm != null)
            sm.checkPermission(new AuthPermission("refreshLoginConfiguration"));

        java.security.AccessController.doPrivileged
            (new java.security.PrivilegedAction<Void>() {
            public Void run() {
                try {
View Full Code Here


        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

  /**
   * 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

public class AuthPermissionTest extends SerializationTest {

    @Override
    protected Object[] getData() {
        return new Object[] {new AuthPermission("name", "read")};
    }
View Full Code Here

        try {
            System.setProperty(LOGIN_CONFIG,
                    new File(otherConfFile).getCanonicalPath());

        DefaultConfiguration dc = new DefaultConfiguration();
        MySecurityManager checker = new MySecurityManager(new AuthPermission(
                "refreshLoginConfiguration"), true);
        System.setSecurityManager(checker);
        dc.refresh();
        assertTrue(checker.checkAsserted);
        checker.reset();
View Full Code Here

        assertNotNull(new SubjectDomainCombiner(new Subject()).combine(new ProtectionDomain[] {null}, new ProtectionDomain[] {null}));
    }

    public final void testSecurityException() {

        denyPermission(new AuthPermission("getSubjectFromDomainCombiner"));

        try {
            new SubjectDomainCombiner(new Subject()).getSubject();
        } catch (AccessControlException e) {
            assertEquals(e, AuthPermission.class);
View Full Code Here

        assertEquals(in.getYear(), out.getYear());
    }

    public void testAuthPermission() throws Exception
    {
        AuthPermission in = new AuthPermission("foo");
        String json = MAPPER.writeValueAsString(in);
        assertNotNull(json);
       
        // actually, deserialization won't work by default. So let's just check
        // some lexical aspects
View Full Code Here

     */
    public synchronized void refresh() {

        java.lang.SecurityManager sm = System.getSecurityManager();
        if (sm != null)
            sm.checkPermission(new AuthPermission("refreshLoginConfiguration"));

        java.security.AccessController.doPrivileged
            (new java.security.PrivilegedAction<Void>() {
            public Void run() {
                try {
View Full Code Here

            } else {
                // use the default JAAS login configuration (file-based)
                SecurityManager sm = System.getSecurityManager();
                if (sm != null) {
                    sm.checkPermission(
                            new AuthPermission("createLoginContext." +
                                               LOGIN_CONFIG_NAME));
                }

                final String pf = passwordFile;
                try {
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.