Package com.sun.enterprise.config.serverbeans

Examples of com.sun.enterprise.config.serverbeans.IdentityAssertionTrust


    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom validation do basic validation
        String choice = cce.getChoice();
        try {
            if (choice.equals(StaticTest.ADD) || choice.equals(StaticTest.VALIDATE)) {
                final IdentityAssertionTrust iat = (IdentityAssertionTrust) cce.getObject();
                Config c = (Config) ((SecurityService) cce.getClassObject()).parent();
                boolean isDefault = iat.isIsDefault();
                if (isDefault) {
                    String trustId = checkIsDefault(c);
                    if (flag && (trustId != null)) {
                        result.failed(_strMgr.getString("DefaultTrustConfigExists", trustId));
                    }
                }
            }
            if (choice.equals(StaticTest.UPDATE)) {
                if (ConfigBean.toBoolean((String) cce.getObject())) {
                    final IdentityAssertionTrust iat = (IdentityAssertionTrust) cce.getClassObject();
                    final Config c = (Config) ((SecurityService) iat.parent()).parent();
                    String trustId = checkIsDefault(c);
                    if (flag) {
                        result.failed(_strMgr.getString("DefaultTrustConfigExists", trustId));
                    }
                }
View Full Code Here


            Config[] configArray = configs.getConfig();          
            for (int i = 0; i < configArray.length; i++) {
                SecurityService ss = configArray[i].getSecurityService();
                IdentityAssertionTrust[] iatList = ss.getIdentityAssertionTrust();
                for (int j = 0; j < iatList.length; j++) {
                    IdentityAssertionTrust iat = iatList[j];
                    PAssertedAuthenticator pa = new PAssertedAuthenticator(iat);
                    String key = iat.getId();
                    assertionMap.put(key, pa);
                    if (iat.isIsDefault()) {
                        defaultAuth = pa;
                    }
                }
            }
View Full Code Here

                if (configObject instanceof ConfigUpdate) {
                    configUpdate = (ConfigUpdate)configObject;
                    xpath = configUpdate.getXPath();
                    object = configContext.exactLookup(xpath);
                    if (object instanceof IdentityAssertionTrust) {
                        IdentityAssertionTrust iat = (IdentityAssertionTrust) object;
                        PAssertedAuthenticator pa = new PAssertedAuthenticator(iat);
                        String key = iat.getId();
                        assertionMap.put(key, pa);
                        if (iat.isIsDefault()) {
                            defaultAuth = pa;
                        }
                    }
                }
            }
View Full Code Here

                if (configObject instanceof ConfigAdd) {
                    configAdd = (ConfigAdd) configObject;
                    xpath = configAdd.getXPath();
                    object = configContext.exactLookup(xpath);
                    if (object instanceof IdentityAssertionTrust) {
                        IdentityAssertionTrust iat = (IdentityAssertionTrust) object;
                        PAssertedAuthenticator pa = new PAssertedAuthenticator(iat);
                        String key = iat.getId();
                        assertionMap.put(key, pa);
                        if (iat.isIsDefault()) {
                            defaultAuth = pa;
                        }
                    }
                }
            }
View Full Code Here

                //object = configContext.exactLookup(xpath);
                String id = getIdFromXpath(xpath);
                if (id == null) {
                    continue;
                }
                IdentityAssertionTrust iat = secService.getIdentityAssertionTrustById(id);
                if (iat == null) {
                    continue;
                }
                PAssertedAuthenticator pa = new PAssertedAuthenticator(iat);
                String key = iat.getId();
                assertionMap.put(key, pa);
                if (iat.isIsDefault()) {
                    defaultAuth = pa;
                }
            }

        } catch (Exception ex) {
View Full Code Here

            String msg = _strMgr.getString("IpAddMustforTrustedEntity");
            throw new MBeanConfigException(msg);
        }

        // identity assertion trust
        IdentityAssertionTrust trustConfig = securityService.getIdentityAssertionTrustById(trustId);
        if (trustConfig != null)
        {
            String msg = _strMgr.getString("IdentityTrustAlreadyExists", trustId);
            throw new MBeanConfigException(msg);
        }

        // we have to create it
        trustConfig = new IdentityAssertionTrust();
        if (trustId == null)
            trustId = generateTrustId(securityService);
        trustConfig.setId(trustId);
        trustConfig.setIsDefault(Boolean.parseBoolean(isDefault));

        // create the trust handler
        if ( cName != null) {
            TrustHandler tHandler = new TrustHandler();
            tHandler.setClassName(cName);
            securityService.addIdentityAssertionTrust(trustConfig);
            if (props != null) {
                tHandler.setElementProperty(convertPropertiesToElementProperties(props));
            }
            trustConfig.setTrustHandler(tHandler);
//            return trustId;
            return getMBeanRegistry().getMbeanObjectName("trust-handler",
                   new String[]{getDomainName(), configName, trustId});
        }

        // ip address is must for trusted entity config
        if ( ipAdd != null) {
            TrustedEntity tEntity = new TrustedEntity();
            if (entityId == null)
                entityId = "entityid-0";
            tEntity.setId(entityId);
            if (trustedAs != null)
                tEntity.setTrustedAs(trustedAs);
            tEntity.setIpAddress(ipAdd);
            tEntity.setPrincipal(principal);
            tEntity.setHostName(hostName);
            trustConfig.addTrustedEntity(tEntity);
            securityService.addIdentityAssertionTrust(trustConfig);
//            return trustId;
            return getMBeanRegistry().getMbeanObjectName("trusted-entity",
                   new String[]{getDomainName(), configName, trustId, entityId});
        }

        TrustHandler tHandler = new TrustHandler();
        // use the default trust handler implementation
        tHandler.setClassName(DEFAULT_TRUST_HANDLER);

        trustConfig.setTrustHandler(tHandler);
        securityService.addIdentityAssertionTrust(trustConfig);

//        return trustId;
        return getMBeanRegistry().getMbeanObjectName("trust-handler",
               new String[]{getDomainName(), configName, trustId});
View Full Code Here

    /**
     * Method to generate trust ids automatically for identity-assertion-trust
     */
    public String generateTrustId(SecurityService ss) {
        String id = null;
        IdentityAssertionTrust trustConfig = null;
        for (int i=0; ; i++) {
            id = "trustid-" + i;
            trustConfig = ss.getIdentityAssertionTrustById(id);
            if (trustConfig == null)
                break;
View Full Code Here

    throws Exception
    {
        final Target target = getTarget(targetName);
//        check1ToN(target);
        SecurityService securityService = getSecurityServiceConfigBean(target.getConfigTarget().getName());
        IdentityAssertionTrust trustConfig = securityService.getIdentityAssertionTrustById(id);

        if (trustConfig == null)
        {
            String msg = _strMgr.getString("IdentityTrustDoesntExist", id);
            throw new MBeanConfigException(msg);
View Full Code Here

        SecurityService securityService = getSecurityServiceConfigBean(target.getConfigTarget().getName());

        // if trustId is specified, list all trusted entities for that config
        if (trustId != null)
        {
            IdentityAssertionTrust trustConfig =
                   securityService.getIdentityAssertionTrustById(trustId);
            if (trustConfig == null)
            {
                String msg = _strMgr.getString("IdentityTrustDoesntExist", trustId);
                throw new MBeanConfigException(msg);
View Full Code Here

                host = (String)attr.getValue();
            else if (isAttrNameMatch(attr, "principal"))
                principal = (String)attr.getValue();
        }

        IdentityAssertionTrust trustConfig =
            securityService.getIdentityAssertionTrustById(trustId);
        // invalid trustId was specified
        if (trustConfig == null)
        {
            String msg = _strMgr.getString("IdentityTrustDoesntExist", trustId);
            throw new MBeanConfigException(msg);
        }

        // check if a trust handler is already configured for this trust config
        TrustHandler tHandler = trustConfig.getTrustHandler();
        if (tHandler != null) {
            String msg = _strMgr.getString("TrustHandlerAlreadyExistsForTrustConfig", trustId);
            throw new MBeanConfigException(msg);
        }
           
        TrustedEntity tEntity = new TrustedEntity();
        if (id == null)
            id = generateEntityId(trustConfig);

        tEntity.setId(id);

        if (trustedAs != null)
            tEntity.setTrustedAs(trustedAs);

        tEntity.setIpAddress(ipAdd);
        if (host != null)
            tEntity.setHostName(host);
        if (principal != null)
            tEntity.setPrincipal(principal);

        trustConfig.addTrustedEntity(tEntity);

        return true;
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.IdentityAssertionTrust

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.