Package java.security

Examples of java.security.DomainCombiner


        PrivilegedAction<DomainCombiner> action = new PrivilegedAction<DomainCombiner>() {
            public DomainCombiner run() {
                return context.getDomainCombiner();
            }
        };
        DomainCombiner combiner = AccessController.doPrivileged(action);

        if ((combiner == null) || !(combiner instanceof SubjectDomainCombiner)) {
            return null;
        }
        return ((SubjectDomainCombiner) combiner).getSubject();
View Full Code Here


        }
    }
   
    private AccessControlContext createAccessControlContext() {
        return new AccessControlContext(AccessController.getContext(),
                new DomainCombiner() {              
                    public ProtectionDomain[] combine(ProtectionDomain[] arg0,
                                                      ProtectionDomain[] arg1) {                   
                        return new ProtectionDomain[] { new ProtectionDomain(null, null) {                       
                            public boolean implies(Permission permission) {                                                          
                                return bundleContext.getBundle().hasPermission(permission);
View Full Code Here

        }
    }
   
    private AccessControlContext createAccessControlContext() {
        return new AccessControlContext(AccessController.getContext(),
                new DomainCombiner() {              
                    public ProtectionDomain[] combine(ProtectionDomain[] arg0,
                                                      ProtectionDomain[] arg1) {                   
                        return new ProtectionDomain[] { new ProtectionDomain(null, null) {                       
                            public boolean implies(Permission permission) {                                                          
                                return bundleContext.getBundle().hasPermission(permission);
View Full Code Here

     * Case 0: If no Config provided by user, then LoginContext uses
     * its own context to invoke LoginModule's methods.
     */
    public void testContextUsage_0() throws Exception {
        Subject dummySubj = new Subject();
        final DomainCombiner dc = new SubjectDomainCombiner(dummySubj);
        AccessControlContext acc = new AccessControlContext(AccessController
                .getContext(), dc);
        PrivilegedExceptionAction<Void> action = new PrivilegedExceptionAction<Void>() {
            public Void run() throws Exception {
                implTestContextUsage(true, dc);
View Full Code Here

     * uses stored user's context and performs all call to LoginModule's
     * methods in that context.
     */
    public void testContextUsage_1() throws Exception {
        Subject dummySubj = new Subject();
        final DomainCombiner dc = new SubjectDomainCombiner(dummySubj);
        AccessControlContext acc = new AccessControlContext(AccessController
                .getContext(), dc);
        PrivilegedExceptionAction<Void> action = new PrivilegedExceptionAction<Void>() {
            public Void run() throws Exception {
                implTestContextUsage(false, dc);
View Full Code Here

            fail("must not pass here");
        } catch (LoginException _) {
            // gut
        }

        DomainCombiner match = useInstalledConfig ? null : dc;
        //
        if (checkModuleStatic) {
            assertSame(TestLoginModule_Contexted.accStatic.getDomainCombiner(),
                    match);
        }
View Full Code Here

        // return the Subject from the DomainCombiner of the provided context
        return AccessController.doPrivileged
            (new java.security.PrivilegedAction<Subject>() {
            public Subject run() {
                DomainCombiner dc = acc.getDomainCombiner();
                if (!(dc instanceof SubjectDomainCombiner))
                    return null;
                SubjectDomainCombiner sdc = (SubjectDomainCombiner)dc;
                return sdc.getSubject();
            }
View Full Code Here

        PrivilegedAction<DomainCombiner> action = new PrivilegedAction<DomainCombiner>() {
            public DomainCombiner run() {
                return context.getDomainCombiner();
            }
        };
        DomainCombiner combiner = AccessController.doPrivileged(action);

        if ((combiner == null) || !(combiner instanceof SubjectDomainCombiner)) {
            return null;
        }
        return ((SubjectDomainCombiner) combiner).getSubject();
View Full Code Here

                            throw new RuntimeException(throwable);
                        }
                    }
                    return null;
                }
            }, new AccessControlContext(getContext(), new DomainCombiner() {
                @Override
                public ProtectionDomain[] combine(final ProtectionDomain[] currentDomains, final ProtectionDomain[] assignedDomains) {
                    return assignedDomains;
                }
            }));
View Full Code Here

                            errors.add(e);
                        }
                    }
                    return null;
                }
            }, new AccessControlContext(getContext(), new DomainCombiner() {
                @Override
                public ProtectionDomain[] combine(final ProtectionDomain[] currentDomains, final ProtectionDomain[] assignedDomains) {
                    return assignedDomains;
                }
            }));
View Full Code Here

TOP

Related Classes of java.security.DomainCombiner

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.