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


     * 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

     */
    private static AccessControlContext createPrivilegedContext(
                Class caller,
                AccessControlContext acc)
    {
  DomainCombiner comb = acc.getDomainCombiner();
  ProtectionDomain pd = caller.getProtectionDomain();
  ProtectionDomain[] pds = (pd != null) ?
      new ProtectionDomain[]{pd} : null;
  if (comb != null) {
      pds = comb.combine(pds, null);
  }
  if (pds == null) {
      pds = new ProtectionDomain[0];
  }
  return new AccessControlContext(new AccessControlContext(pds), comb);
View Full Code Here

    public SecurityContext getContext() {
  final AccessControlContext acc0 = AccessController.getContext();
  final AccessControlContext racc = (AccessControlContext)
      AccessController.doPrivileged(new PrivilegedAction() {
    public Object run() {
        DomainCombiner comb0 = acc0.getDomainCombiner();
        AccessControlContext acc1 =
      new AccessControlContext(acc0, new Combiner(comb0));
        AccessControlContext acc2 = (AccessControlContext)
      AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
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

   * of blueprint-core. To achieve this we use an access context.
   * @return
   */
    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 getBundleContextForServiceLookup().getBundle().hasPermission(permission);
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.