⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cardissuerconfig.java

📁 开源的OpenId的一个java实现
💻 JAVA
字号:
/* * Copyright 2005-2007 WSO2, Inc. (http://wso2.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.wso2.solutions.identity.cards;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.xml.security.signature.XMLSignature;import org.wso2.solutions.identity.IdentityConstants;import org.wso2.solutions.identity.IdentityProviderConstants;import org.wso2.solutions.identity.IdentityProviderException;import org.wso2.solutions.identity.admin.ParameterAdmin;import org.wso2.solutions.identity.cards.model.SupportedTokenTypeList;import org.wso2.solutions.identity.i18n.Messages;import org.wso2.utils.ServerConfiguration;import org.wso2.wsas.ServerConstants;/** * Configuration of the information card issuer. */public class CardIssuerConfig {    private final static Log log = LogFactory.getLog(CardIssuerConfig.class);    private final static Messages messages = Messages            .getInstance(IdentityProviderConstants.RESOURCES);    private String issuer = null;    private int validPeriod = 0; // in days    private SupportedTokenTypeList tokenTypeList = null;    private String cardName = null;    private boolean useSymmetricBinding = false;    private String sigAlgo = XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1;    public final static String DEFAULT_CONFIG_FILE_PATH = System            .getProperty(ServerConstants.WSO2WSAS_HOME)            + "/conf/infocard-issuer-config.xml";    private static CardIssuerConfig config;    public static CardIssuerConfig getInstance()            throws IdentityProviderException {        if (config == null) {            config = new CardIssuerConfig();        }        return config;    }    public static CardIssuerConfig updateConfig()            throws IdentityProviderException {        config = new CardIssuerConfig();        return config;    }    private CardIssuerConfig() throws IdentityProviderException {        ParameterAdmin admin = new ParameterAdmin();        ServerConfiguration serverConf =  ServerConfiguration.getInstance();        String hostName = serverConf.getFirstProperty("HostName");        issuer = "http://"+hostName;        validPeriod = Integer.parseInt(admin.getParameterValue(IdentityConstants.PARAM_VALID_PERIOD));        cardName = admin.getParameterValue(IdentityConstants.PARAM_CARD_NAME);        String types = admin.getParameterValue(IdentityConstants.PARAM_SUPPORTED_TOKEN_TYPES);        String[] arrTypes = types.split(",");        tokenTypeList = new SupportedTokenTypeList();        for(int i=0; i<arrTypes.length; i++){            tokenTypeList.addSupportedTokenType(arrTypes[i]);        }                useSymmetricBinding  = admin.getParameter(IdentityConstants.PARAM_USE_SYMM_BINDING) != null;    }    public String getCardName() {        return cardName;    }    public void setCardName(String cardName) {        this.cardName = cardName;    }    public String getIssuer() {        return issuer;    }    public void setIssuer(String issuer) {        this.issuer = issuer;    }    public SupportedTokenTypeList getTokenTypeList() {        return tokenTypeList;    }    public void setTokenTypeList(SupportedTokenTypeList tokenTypeList) {        this.tokenTypeList = tokenTypeList;    }    public int getValidPeriod() {        return validPeriod;    }    public void setValidPeriod(int validPeriod) {        this.validPeriod = validPeriod;    }    public String getSigAlgo() {        return sigAlgo;    }    public void setSigAlgo(String sigAlgo) {        this.sigAlgo = sigAlgo;    }    public boolean isUseSymmetricBinding() {        return useSymmetricBinding;    }    public void setUseSymmetricBinding(boolean useSymmetricBinding) {        this.useSymmetricBinding = useSymmetricBinding;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -