/* * Copyright 2003 Federal Chancellery Austria * MOA-ID has been developed in a cooperation between BRZ, the Federal * Chancellery Austria - ICT staff unit, and Graz University of Technology. * * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * http://www.osor.eu/eupl/ * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. * * This product combines work with different licenses. See the "NOTICE" text * file for details on the various modules and licenses. * The "NOTICE" text file is part of the distribution. Any derivative works * that you distribute must include a readable copy of the "NOTICE" text file. */ package at.gv.egovernment.moa.id.config.auth; import java.util.ArrayList; import java.util.List; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; import at.gv.egovernment.moa.id.commons.db.dao.config.BKUSelectionCustomizationType; import at.gv.egovernment.moa.id.commons.db.dao.config.BKUURLS; import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber; import at.gv.egovernment.moa.id.commons.db.dao.config.Mandates; import at.gv.egovernment.moa.id.commons.db.dao.config.OAPVP2; import at.gv.egovernment.moa.id.commons.db.dao.config.OASAML1; import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.TemplateType; import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType; import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType; import at.gv.egovernment.moa.id.config.ConfigurationUtils; import at.gv.egovernment.moa.id.config.OAParameter; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; import eu.stork.vidp.messages.builder.STORKMessagesBuilder; import eu.stork.vidp.messages.common.STORKConstants; import eu.stork.vidp.messages.stork.QualityAuthenticationAssuranceLevel; import eu.stork.vidp.messages.stork.RequestedAttributes; /** * Configuration parameters belonging to an online application, * to use with the MOA ID Auth component. * * @author Stefan Knirsch * @version $Id$ */ /** * * * @author Harald Bratko */ public class OAAuthParameter extends OAParameter { public static final String ONLINEBKU = "online"; public static final String HANDYBKU = "handy"; public static final String LOCALBKU = "local"; private AuthComponentOA oa_auth; public OAAuthParameter(OnlineApplication oa) { super(oa); this.oa_auth = oa.getAuthComponentOA(); this.keyBoxIdentifier = oa.getKeyBoxIdentifier().value(); } /** * STORK QAA Level, Default = 4 */ private QualityAuthenticationAssuranceLevel qaaLevel = STORKMessagesBuilder.buildQualityAuthenticationAssuranceLevel(4); /** * STORK RequestedAttributes for Online Application * Default RequestedAttributes are: eIdentifier, givenName, surname, dateOfBirth */ private RequestedAttributes requestedAttributes = STORKMessagesBuilder.buildRequestedAttributes( STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_EIDENTIFIER, true, null), STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_GIVENNAME, true, null), STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_SURNAME, true, null), STORKMessagesBuilder.buildRequestedAttribute(STORKConstants.STORK_ATTRIBUTE_DATEOFBIRTH, false, null)); private String keyBoxIdentifier; /** * @return the slVersion */ //public String getSlVersion() { // return oa_auth.getSlVersion(); //} // ///** // * @return the slVersion12 // */ //public boolean isSlVersion12() { // // // set SLVersion to 1.2 per default // return true; // //// if ("1.2".equals(oa_auth.getSlVersion())) //// return true; //// else //// return false; //} //public boolean getUseUTC() { // return oa_auth.isUseUTC(); //} // //public boolean useIFrame() { // return oa_auth.isUseIFrame(); //} /** * @return the identityLinkDomainIdentifier */ public String getIdentityLinkDomainIdentifier() { IdentificationNumber idnumber = oa_auth.getIdentificationNumber(); if (idnumber != null) return idnumber.getValue(); return null; } /** * @return the keyBoxIdentifier */ public String getKeyBoxIdentifier() { return keyBoxIdentifier; } /** * @return the transformsInfos */ public List getTransformsInfos() { List transformations = oa_auth.getTransformsInfo(); return ConfigurationUtils.getTransformInfos(transformations); } public OASAML1 getSAML1Parameter() { return oa_auth.getOASAML1(); } public OAPVP2 getPVP2Parameter() { return oa_auth.getOAPVP2(); } ///** // * @return the bkuSelectionTemplateURL // */ //public String getBkuSelectionTemplateURL() { // return bkuSelectionTemplateURL; //} /** * @return the templateURL */ public List getTemplateURL() { TemplatesType templates = oa_auth.getTemplates(); if (templates != null) { if (templates.getTemplate() != null) { return templates.getTemplate(); } } return null; } public String getAditionalAuthBlockText() { TemplatesType templates = oa_auth.getTemplates(); if (templates != null) { return templates.getAditionalAuthBlockText(); } return null; } public String getBKUURL(String bkutype) { BKUURLS bkuurls = oa_auth.getBKUURLS(); if (bkuurls != null) { if (bkutype.equals(ONLINEBKU)) return bkuurls.getOnlineBKU(); else if (bkutype.equals(HANDYBKU)) return bkuurls.getHandyBKU(); else if (bkutype.equals(LOCALBKU)) return bkuurls.getLocalBKU(); } Logger.warn("BKU Type does not match: " + ONLINEBKU + " or " + HANDYBKU + " or " + LOCALBKU); return null; } public List getBKUURL() { BKUURLS bkuurls = oa_auth.getBKUURLS(); List list = new ArrayList(); if (bkuurls == null) { Logger.warn("BKU Type does not match: " + ONLINEBKU + " or " + HANDYBKU + " or " + LOCALBKU); } else { list.add(bkuurls.getOnlineBKU()); list.add(bkuurls.getHandyBKU()); list.add(bkuurls.getLocalBKU()); } return list; } public boolean useSSO() { OASSO sso = oa_auth.getOASSO(); if (sso != null) return sso.isUseSSO(); else return false; } public boolean useSSOQuestion() { OASSO sso = oa_auth.getOASSO(); if (sso != null) return sso.isAuthDataFrame(); else return true; } public String getSingleLogOutURL() { OASSO sso = oa_auth.getOASSO(); if (sso != null) return sso.getSingleLogOutURL(); else return null; } ///** // * @return the inputProcessorSignTemplateURL // */ //public String getInputProcessorSignTemplateURL() { // return inputProcessorSignTemplateURL; //} ///** // * @return the verifyInfoboxParameters // */ //public VerifyInfoboxParameters getVerifyInfoboxParameters() { // return verifyInfoboxParameters; //} /** * @return the mandateProfiles */ public String getMandateProfiles() { Mandates mandates = oa_auth.getMandates(); if (mandates != null) return mandates.getProfiles(); else return null; } /** * @return the identityLinkDomainIdentifierType */ public String getIdentityLinkDomainIdentifierType() { IdentificationNumber idnumber = oa_auth.getIdentificationNumber(); if (idnumber != null) return idnumber.getType(); return null; } public String getBKUSelectionBackGroundColor() { TemplatesType templates = oa_auth.getTemplates(); if (templates != null) { BKUSelectionCustomizationType bkuselection = templates.getBKUSelectionCustomization(); if (bkuselection != null) { if (MiscUtil.isNotEmpty(bkuselection.getBackGroundColor())) return bkuselection.getBackGroundColor(); } } return null; } public boolean isShowMandateCheckBox() { TemplatesType templates = oa_auth.getTemplates(); if (templates != null) { BKUSelectionCustomizationType bkuselection = templates.getBKUSelectionCustomization(); if (bkuselection != null) { if (bkuselection.isMandateLoginButton() != null) return bkuselection.isMandateLoginButton(); } } return true; } public boolean isOnlyMandateAllowed() { TemplatesType templates = oa_auth.getTemplates(); if (templates != null) { BKUSelectionCustomizationType bkuselection = templates.getBKUSelectionCustomization(); if (bkuselection != null) { if (bkuselection.isOnlyMandateLoginAllowed() != null) return bkuselection.isOnlyMandateLoginAllowed(); } } return false; } /** * @return the qaaLevel */ public QualityAuthenticationAssuranceLevel getQaaLevel() { return qaaLevel; } /** * @return the requestedAttributes */ public RequestedAttributes getRequestedAttributes() { return requestedAttributes; } }