Examples of JASPIAuthenticationInfo


Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

     
      ApplicationPolicy aPolicy = config.get("TestRoleMapping");
      //Test Authentication
      BaseAuthenticationInfo infoBase = aPolicy.getAuthenticationInfo();
      assertTrue("infoBase==AuthenticationJaspiInfo", infoBase instanceof JASPIAuthenticationInfo);
      JASPIAuthenticationInfo info = (JASPIAuthenticationInfo)infoBase;
      assertTrue("jaspi != null", info != null);
      AuthModuleEntry[] authEntry = info.getAuthModuleEntry();
      //Get the first AuthModule
      AuthModuleEntry aEntry1 = authEntry[0];
      validateAuthModule1(aEntry1);
      //Get the second AuthModule
      AuthModuleEntry aEntry2 = authEntry[1];
View Full Code Here

Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

        // authentication-jaspi
        node = operation.get(AUTHENTICATION_JASPI);
        if (node.isDefined()) {
            if (applicationPolicy == null)
                applicationPolicy = new ApplicationPolicy(securityDomain);
            JASPIAuthenticationInfo authenticationInfo = new JASPIAuthenticationInfo(securityDomain);
            Map<String, LoginModuleStackHolder> holders = new HashMap<String, LoginModuleStackHolder>();
            ModelNode moduleStack = node.get(LOGIN_MODULE_STACK);
            modules = moduleStack.asList();
            for (ModelNode loginModuleStack : modules) {
                List<ModelNode> nodes = loginModuleStack.asList();
                Iterator<ModelNode> iter = nodes.iterator();
                ModelNode nameNode = iter.next();
                String name = nameNode.get(NAME).asString();
                LoginModuleStackHolder holder = new LoginModuleStackHolder(name, null);
                holders.put(name, holder);
                authenticationInfo.add(holder);
                while (iter.hasNext()) {
                    ModelNode lmsNode = iter.next();
                    List<ModelNode> lms = lmsNode.asList();
                    for (ModelNode lmNode : lms) {
                        String code = lmNode.require(CODE).asString();
                        LoginModuleControlFlag controlFlag = getControlFlag(lmNode.require(FLAG).asString());
                        Map<String, Object> options = new HashMap<String, Object>();
                        if (lmNode.hasDefined(MODULE_OPTIONS)) {
                            for (Property prop : lmNode.get(MODULE_OPTIONS).asPropertyList()) {
                                options.put(prop.getName(), prop.getValue().asString());
                            }
                        }
                        AppConfigurationEntry entry = new AppConfigurationEntry(code, controlFlag, options);
                        holder.addAppConfigurationEntry(entry);
                    }
                }
            }
            ModelNode authModuleNode = node.get(AUTH_MODULE);
            List<ModelNode> authModules = authModuleNode.asList();
            for (ModelNode authModule : authModules) {
                String code = authModule.require(CODE).asString();
                String loginStackRef = null;
                if (authModule.hasDefined(LOGIN_MODULE_STACK_REF))
                    loginStackRef = authModule.get(LOGIN_MODULE_STACK_REF).asString();
                Map<String, Object> options = new HashMap<String, Object>();
                if (authModule.hasDefined(MODULE_OPTIONS)) {
                    for (Property prop : authModule.get(MODULE_OPTIONS).asPropertyList()) {
                        options.put(prop.getName(), prop.getValue().asString());
                    }
                }
                AuthModuleEntry entry = new AuthModuleEntry(code, options, loginStackRef);
                if (loginStackRef != null) {
                    if (!holders.containsKey(loginStackRef)) {
                        throw new IllegalArgumentException("auth-module references a login module stack that doesn't exist: "
                                + loginStackRef);
                    }
                    entry.setLoginModuleStackHolder(holders.get(loginStackRef));
                }
                authenticationInfo.add(entry);
            }
            applicationPolicy.setAuthenticationInfo(authenticationInfo);
        }

        return applicationPolicy;
View Full Code Here

Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

        }

        // authentication-jaspi
        node = operation.get(Element.AUTHENTICATION_JASPI.getLocalName());
        if (node.isDefined()) {
            JASPIAuthenticationInfo authenticationInfo = new JASPIAuthenticationInfo(securityDomain);
            Map<String, LoginModuleStackHolder> holders = new HashMap<String, LoginModuleStackHolder>();
            ModelNode moduleStack = node.get(Element.LOGIN_MODULE_STACK.getLocalName());
            modules = moduleStack.asList();
            Iterator<ModelNode> iter = modules.iterator();
            ModelNode nameNode = iter.next();
            String name = nameNode.get(Attribute.NAME.getLocalName()).asString();
            LoginModuleStackHolder holder = new LoginModuleStackHolder(name, null);
            holders.put(name, holder);
            authenticationInfo.add(holder);
            while (iter.hasNext()) {
                ModelNode module = iter.next();
                String code = module.require(Attribute.CODE.getLocalName()).asString();
                LoginModuleControlFlag controlFlag = getControlFlag(module.require(Attribute.FLAG.getLocalName()).asString());
                Map<String, Object> options = new HashMap<String, Object>();
                if (module.hasDefined(MODULE_OPTIONS)) {
                    for (Property prop : module.get(MODULE_OPTIONS).asPropertyList()) {
                        options.put(prop.getName(), prop.getValue().asString());
                    }
                }
                AppConfigurationEntry entry = new AppConfigurationEntry(code, controlFlag, options);
                holder.addAppConfigurationEntry(entry);
            }
            ModelNode authModule = node.get(Element.AUTH_MODULE.getLocalName());
            String code = authModule.require(Attribute.CODE.getLocalName()).asString();
            String loginStackRef = null;
            if (authModule.hasDefined(Attribute.LOGIN_MODULE_STACK_REF.getLocalName()))
                loginStackRef = authModule.get(Attribute.LOGIN_MODULE_STACK_REF.getLocalName()).asString();
            Map<String, Object> options = new HashMap<String, Object>();
            if (authModule.hasDefined(MODULE_OPTIONS)) {
                for (Property prop : authModule.get(MODULE_OPTIONS).asPropertyList()) {
                    options.put(prop.getName(), prop.getValue().asString());
                }
            }
            AuthModuleEntry entry = new AuthModuleEntry(code, options, loginStackRef);
            if (loginStackRef != null) {
                if (!holders.containsKey(loginStackRef)) {
                    throw new IllegalArgumentException("auth-module references a login module stack that doesn't exist: "
                            + loginStackRef);
                }
                entry.setLoginModuleStackHolder(holders.get(loginStackRef));
            }
            authenticationInfo.add(entry);
            applicationPolicy.setAuthenticationInfo(authenticationInfo);
        }

        return applicationPolicy;
    }
View Full Code Here

Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

         SecurityActions.addModules(binfo, authenticationModuleEntries);
         info.setAuthenticationInfo(binfo);
      }
      if(isJASPIAuthentication)
      {
         binfo = new JASPIAuthenticationInfo(authName);
         SecurityActions.addModules(binfo, authenticationModuleEntries);
         info.setAuthenticationInfo(binfo);
      }
      if(isAuthorization)
      {
View Full Code Here

Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

     
      ApplicationPolicy aPolicy = config.get("TestAuthorization");
      //Test Authentication
      BaseAuthenticationInfo infoBase = aPolicy.getAuthenticationInfo();
      assertTrue("infoBase==AuthenticationJaspiInfo", infoBase instanceof JASPIAuthenticationInfo);
      JASPIAuthenticationInfo info = (JASPIAuthenticationInfo)infoBase;
      assertTrue("jaspi != null", info != null);
      AuthModuleEntry[] authEntry = info.getAuthModuleEntry();
      //Get the first AuthModule
      AuthModuleEntry aEntry1 = authEntry[0];
      validateAuthModule1(aEntry1);
      //Get the second AuthModule
      AuthModuleEntry aEntry2 = authEntry[1];
View Full Code Here

Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

      PolicyConfig config = getPolicyConfig("security/jaspi/login-config-jaspi.xml",lcomf);
      assertNotNull("Returned PolicyConfig is != null ?", config);
      ApplicationPolicy aPolicy = config.get("jaspi");
      BaseAuthenticationInfo infoBase = aPolicy.getAuthenticationInfo();
      assertTrue("infoBase==AuthenticationJaspiInfo", infoBase instanceof JASPIAuthenticationInfo);
      JASPIAuthenticationInfo info = (JASPIAuthenticationInfo)infoBase;
      assertTrue("jaspi != null", info != null);
      AuthModuleEntry[] authEntry = info.getAuthModuleEntry();
      //Get the first AuthModule
      AuthModuleEntry aEntry1 = authEntry[0];
      validateAuthModule1(aEntry1);
      //Get the second AuthModule
      AuthModuleEntry aEntry2 = authEntry[1];
View Full Code Here

Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

     
      ApplicationPolicy aPolicy = config.get("TestRoleMapping");
      //Test Authentication
      BaseAuthenticationInfo infoBase = aPolicy.getAuthenticationInfo();
      assertTrue("infoBase==AuthenticationJaspiInfo", infoBase instanceof JASPIAuthenticationInfo);
      JASPIAuthenticationInfo info = (JASPIAuthenticationInfo)infoBase;
      assertTrue("jaspi != null", info != null);
      AuthModuleEntry[] authEntry = info.getAuthModuleEntry();
      //Get the first AuthModule
      AuthModuleEntry aEntry1 = authEntry[0];
      validateAuthModule1(aEntry1);
      //Get the second AuthModule
      AuthModuleEntry aEntry2 = authEntry[1];
View Full Code Here

Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

      AuthenticationInfo info = (AuthenticationInfo)aPolicy.getAuthenticationInfo();
      validateJaasBindings(info);
     
      //Validate the JASPI bindings
      aPolicy = (ApplicationPolicy)config.get("conf-jaspi");
      JASPIAuthenticationInfo jaspiInfo = (JASPIAuthenticationInfo)aPolicy.getAuthenticationInfo();
      validateJASPIBindings( jaspiInfo );
   }
View Full Code Here

Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

    private boolean processJASPIAuth(OperationContext context, String securityDomain, ModelNode node, ApplicationPolicy applicationPolicy)
            throws OperationFailedException {
        node = peek(node, AUTHENTICATION, JASPI);
        if (node == null) { return false; }

        JASPIAuthenticationInfo authenticationInfo = new JASPIAuthenticationInfo(securityDomain);
        Map<String, LoginModuleStackHolder> holders = new HashMap<String, LoginModuleStackHolder>();
        if(node.hasDefined(LOGIN_MODULE_STACK)){
            List<Property> stacks = node.get(LOGIN_MODULE_STACK).asPropertyList();
            for (Property stack : stacks) {
                String name = stack.getName();
                ModelNode stackNode = stack.getValue();

                final LoginModuleStackHolder holder = new LoginModuleStackHolder(name, null);
                holders.put(name, holder);
                authenticationInfo.add(holder);
                if (stackNode.hasDefined(LOGIN_MODULE)) {
                    processLoginModules(context, stackNode.get(LOGIN_MODULE), authenticationInfo, new LoginModuleContainer() {
                        public void addAppConfigurationEntry(AppConfigurationEntry entry) {
                            holder.addAppConfigurationEntry(entry);
                        }
                    });
                }
            }
        }
        for (Property moduleProperty : node.get(AUTH_MODULE).asPropertyList()) {
            ModelNode authModule = moduleProperty.getValue();
            String code = extractCode(context, authModule, ModulesMap.AUTHENTICATION_MAP);
            String loginStackRef = null;
            if (authModule.hasDefined(LOGIN_MODULE_STACK_REF)) {
                loginStackRef = JASPIMappingModuleDefinition.LOGIN_MODULE_STACK_REF.resolveModelAttribute(context, authModule).asString();
            }
            Map<String, Object> options = extractOptions(context, authModule);
            AuthModuleEntry entry = new AuthModuleEntry(code, options, loginStackRef);
            if (authModule.hasDefined(FLAG)) {
                String flag = LoginModuleResourceDefinition.FLAG.resolveModelAttribute(context, authModule).asString();
                entry.setControlFlag(ControlFlag.valueOf(flag));
            }
            if (loginStackRef != null) {
                if (!holders.containsKey(loginStackRef)) {
                    throw SecurityLogger.ROOT_LOGGER.loginModuleStackIllegalArgument(loginStackRef);
                }
                entry.setLoginModuleStackHolder(holders.get(loginStackRef));
            }
            authenticationInfo.add(entry);

            ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, authModule);
            if (moduleName.isDefined() && moduleName.asString().length() > 0) {
                authenticationInfo.setJBossModuleName(moduleName.asString());
            }
        }
        applicationPolicy.setAuthenticationInfo(authenticationInfo);
        return true;
    }
View Full Code Here

Examples of org.jboss.security.auth.login.JASPIAuthenticationInfo

    private boolean processJASPIAuth(OperationContext context, String securityDomain, ModelNode node, ApplicationPolicy applicationPolicy)
            throws OperationFailedException {
        node = peek(node, AUTHENTICATION, JASPI);
        if (node == null) { return false; }

        JASPIAuthenticationInfo authenticationInfo = new JASPIAuthenticationInfo(securityDomain);
        Map<String, LoginModuleStackHolder> holders = new HashMap<String, LoginModuleStackHolder>();
        List<Property> stacks = node.get(LOGIN_MODULE_STACK).asPropertyList();
        for (Property stack : stacks) {
            String name = stack.getName();
            ModelNode stackNode = stack.getValue();

            final LoginModuleStackHolder holder = new LoginModuleStackHolder(name, null);
            holders.put(name, holder);
            authenticationInfo.add(holder);
            if (stackNode.hasDefined(LOGIN_MODULE)) {
                processLoginModules(context, stackNode.get(LOGIN_MODULE), authenticationInfo, new LoginModuleContainer() {
                    public void addAppConfigurationEntry(AppConfigurationEntry entry) {
                        holder.addAppConfigurationEntry(entry);
                    }
                });
            }
        }
        for (Property moduleProperty : node.get(AUTH_MODULE).asPropertyList()) {
            ModelNode authModule = moduleProperty.getValue();
            String code = extractCode(context, authModule, ModulesMap.AUTHENTICATION_MAP);
            String loginStackRef = null;
            if (authModule.hasDefined(LOGIN_MODULE_STACK_REF)) {
                loginStackRef = JASPIMappingModuleDefinition.LOGIN_MODULE_STACK_REF.resolveModelAttribute(context, authModule).asString();
            }
            Map<String, Object> options = extractOptions(context, authModule);
            AuthModuleEntry entry = new AuthModuleEntry(code, options, loginStackRef);
            if (authModule.hasDefined(FLAG)) {
                String flag = LoginModuleResourceDefinition.FLAG.resolveModelAttribute(context, authModule).asString();
                entry.setControlFlag(ControlFlag.valueOf(flag));
            }
            if (loginStackRef != null) {
                if (!holders.containsKey(loginStackRef)) {
                    throw SecurityMessages.MESSAGES.loginModuleStackIllegalArgument(loginStackRef);
                }
                entry.setLoginModuleStackHolder(holders.get(loginStackRef));
            }
            authenticationInfo.add(entry);

            ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, authModule);
            if (moduleName.isDefined() && moduleName.asString().length() > 0) {
                authenticationInfo.setJBossModuleName(moduleName.asString());
            }
        }
        applicationPolicy.setAuthenticationInfo(authenticationInfo);
        return true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.