Examples of CardIssuerDTO


Examples of org.wso2.carbon.identity.sts.mgt.dto.CardIssuerDTO

public class STSAdminService {

    private final static Log log = LogFactory.getLog(STSAdminService.class);

    public CardIssuerDTO readCardIssuerConfiguration() throws Exception {
        CardIssuerDTO dto = null;
        IdentityPersistenceManager dbAmin = null;
        ParameterDO param = null;
        ArrayList<CardIssuerTokenDTO> supportedTokens = null;
        String[] tokens = null;
        Registry registry = null;

        dbAmin = IdentityPersistenceManager.getPersistanceManager();
        dto = new CardIssuerDTO();
        registry = IdentityTenantUtil.getRegistry();

        supportedTokens = new ArrayList<CardIssuerTokenDTO>();
        param = dbAmin.getParameter(registry, IdentityConstants.PARAM_SUPPORTED_TOKEN_TYPES);

        if (param == null || param.getValue() == null) {
            addParameters(registry);
            param = dbAmin.getParameter(registry, IdentityConstants.PARAM_SUPPORTED_TOKEN_TYPES);
        }

        if (param != null && param.getValue() != null) {
            tokens = param.getValue().split(",");
            CardIssuerTokenDTO token = null;
            for (int i = 0; i < tokens.length; i++) {
                token = new CardIssuerTokenDTO();
                if (tokens[i].trim().length() > 0) {
                    token.setTokenType(getTokenType(tokens[i]));
                    token.setSupported(true);
                    supportedTokens.add(token);
                }
            }
        }

        param = dbAmin.getParameter(registry, IdentityConstants.PARAM_NOT_SUPPORTED_TOKEN_TYPES);
        if (param != null && param.getValue() != null) {
            tokens = param.getValue().split(",");
            CardIssuerTokenDTO token = null;
            for (int i = 0; i < tokens.length; i++) {
                if (tokens[i].trim().length() > 0) {
                    token = new CardIssuerTokenDTO();
                    token.setTokenType(getTokenType(tokens[i]));
                    token.setSupported(false);
                    supportedTokens.add(token);
                }
            }
        }

        dto.setSupportedTokenTypes(supportedTokens.toArray(new CardIssuerTokenDTO[supportedTokens
                .size()]));

        param = dbAmin.getParameter(registry, IdentityConstants.PARAM_CARD_NAME);
        if (param != null && param.getValue() != null) {
            dto.setCardName(param.getValue());
        }

        param = dbAmin.getParameter(registry, IdentityConstants.PARAM_VALID_PERIOD);
        if (param != null && param.getValue() != null) {
            dto.setValidPeriodInDays(Integer.parseInt(param.getValue()));
        }

        param = dbAmin.getParameter(registry, IdentityConstants.PARAM_USE_SYMM_BINDING);
        if (param != null && param.getValue() != null) {
            if ("true".equals(param.getValue())) {
                dto.setSymmetricBinding(true);
            } else {
                dto.setSymmetricBinding(false);
            }
        }

        return dto;
    }
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.