diff options
| author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-08-20 11:18:52 +0200 | 
|---|---|---|
| committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-08-20 11:18:52 +0200 | 
| commit | 3993a8fab1cc23ac1f5e82da88b7e09e27cac563 (patch) | |
| tree | 2ba94c75ecbaf1a707b8968d7cd039a4daccb80e /id/server/idserverlib/src/main | |
| parent | 9331771b24160e0ee04324576d9f35caf6ac4d79 (diff) | |
| download | moa-id-spss-3993a8fab1cc23ac1f5e82da88b7e09e27cac563.tar.gz moa-id-spss-3993a8fab1cc23ac1f5e82da88b7e09e27cac563.tar.bz2 moa-id-spss-3993a8fab1cc23ac1f5e82da88b7e09e27cac563.zip | |
update attribute builder
Diffstat (limited to 'id/server/idserverlib/src/main')
4 files changed, 24 insertions, 2 deletions
| diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/BPKAttributeBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/BPKAttributeBuilder.java index 3dd1dd064..a38446826 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/BPKAttributeBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/BPKAttributeBuilder.java @@ -25,8 +25,10 @@ package at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes;  import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;  import at.gv.egovernment.moa.id.data.IAuthData;  import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.AttributeException; +import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.UnavailableAttributeException;  import at.gv.egovernment.moa.logging.Logger;  import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.MiscUtil;  public class BPKAttributeBuilder implements IPVPAttributeBuilder { @@ -39,9 +41,14 @@ public class BPKAttributeBuilder implements IPVPAttributeBuilder {  		String bpk = authData.getBPK();  		String type = authData.getBPKType(); +		if (MiscUtil.isEmpty(bpk)) +			throw new UnavailableAttributeException(BPK_NAME); +			  		if (type.startsWith(Constants.URN_PREFIX_WBPK))  			type = type.substring((Constants.URN_PREFIX_WBPK + "+").length()); -		else if (type.startsWith(Constants.URN_PREFIX_CDID)) type = type.substring((Constants.URN_PREFIX_CDID + "+").length()); +		 +		else if (type.startsWith(Constants.URN_PREFIX_CDID))  +			type = type.substring((Constants.URN_PREFIX_CDID + "+").length());  		if (bpk.length() > BPK_MAX_LENGTH) {  			bpk = bpk.substring(0, BPK_MAX_LENGTH); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDIdentityLinkBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDIdentityLinkBuilder.java index e8aeb8fcd..29d6df040 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDIdentityLinkBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDIdentityLinkBuilder.java @@ -27,6 +27,7 @@ import java.io.IOException;  import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;  import at.gv.egovernment.moa.id.data.IAuthData;  import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.AttributeException; +import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.UnavailableAttributeException;  import at.gv.egovernment.moa.logging.Logger;  import at.gv.egovernment.moa.util.Base64Utils; @@ -40,6 +41,10 @@ public class EIDIdentityLinkBuilder implements IPVPAttributeBuilder {  			IAttributeGenerator<ATT> g) throws AttributeException {  		try {  			String ilAssertion = null; +			 +			if (authData.getIdentityLink() == null) +				throw new UnavailableAttributeException(EID_IDENTITY_LINK_NAME); +			  			ilAssertion = authData.getIdentityLink().getSerializedSamlAssertion();  			return g.buildStringAttribute(EID_IDENTITY_LINK_FRIENDLY_NAME, diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDSectorForIDAttributeBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDSectorForIDAttributeBuilder.java index 7f52e1d47..463658a3d 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDSectorForIDAttributeBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDSectorForIDAttributeBuilder.java @@ -25,6 +25,8 @@ package at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes;  import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;  import at.gv.egovernment.moa.id.data.IAuthData;  import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.AttributeException; +import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.UnavailableAttributeException; +import at.gv.egovernment.moa.util.MiscUtil;  public class EIDSectorForIDAttributeBuilder implements IPVPAttributeBuilder { @@ -33,8 +35,12 @@ public class EIDSectorForIDAttributeBuilder implements IPVPAttributeBuilder {  	}  	public <ATT> ATT build(OAAuthParameter oaParam, IAuthData authData, -			IAttributeGenerator<ATT> g) throws AttributeException { +			IAttributeGenerator<ATT> g) throws AttributeException {		  		String bpktype = authData.getBPKType(); +		 +		if (MiscUtil.isEmpty(authData.getBPKType())) +			throw new UnavailableAttributeException(EID_SECTOR_FOR_IDENTIFIER_NAME); +				  		return g.buildStringAttribute(EID_SECTOR_FOR_IDENTIFIER_FRIENDLY_NAME,  				EID_SECTOR_FOR_IDENTIFIER_NAME, bpktype);  	} diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDSourcePIN.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDSourcePIN.java index a8b703fc2..16de43e11 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDSourcePIN.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/EIDSourcePIN.java @@ -27,6 +27,7 @@ import at.gv.egovernment.moa.id.data.IAuthData;  import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.AttributeException;  import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.AttributePolicyException;  import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.UnavailableAttributeException; +import at.gv.egovernment.moa.util.MiscUtil;  public class EIDSourcePIN implements IPVPAttributeBuilder  { @@ -41,6 +42,9 @@ public class EIDSourcePIN implements IPVPAttributeBuilder  {  			throw new AttributePolicyException(EID_SOURCE_PIN_NAME);  		else { +			if (MiscUtil.isEmpty(authData.getIdentificationValue())) +				throw new UnavailableAttributeException(EID_SOURCE_PIN_NAME); +			  			return g.buildStringAttribute(EID_SOURCE_PIN_FRIENDLY_NAME, EID_SOURCE_PIN_NAME, authData.getIdentificationValue());  		}  	} | 
