From 9231e07269419fcf32b17d3d2a57c70a47f36866 Mon Sep 17 00:00:00 2001
From: kstranacher <kstranacher@d688527b-c9ab-4aba-bd8d-4036d912da1d>
Date: Tue, 8 Nov 2011 18:49:53 +0000
Subject: =?UTF-8?q?SAML=20Attribute=20OIDTextualDescription=20hinzugef?=
 =?UTF-8?q?=C3=BCgt=20(n=C3=B6tig=20f=C3=BCr=20Organwalter=20und=20berufsm?=
 =?UTF-8?q?.=20Parteienvertreter)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1229 d688527b-c9ab-4aba-bd8d-4036d912da1d
---
 .../moa/id/auth/AuthenticationServer.java          | 74 ++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
index c4ab80c66..f58b41a4e 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
@@ -613,6 +613,22 @@ public class AuthenticationServer implements MOAIDAuthConstants {
       AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(
         session.getPublicOAURLPrefix());
     
+    
+    
+    try {
+    	// sets the extended SAML attributes for OID (Organwalter)
+    	setExtendedSAMLAttributeForMandatesOID(session, mandate, oaParam.getBusinessService());
+	} catch (SAXException e) {
+		throw new AuthenticationException("auth.16", new Object[] { GET_MIS_SESSIONID}, e);
+	} catch (IOException e) {
+		throw new AuthenticationException("auth.16", new Object[] { GET_MIS_SESSIONID}, e);
+	} catch (ParserConfigurationException e) {
+		throw new AuthenticationException("auth.16", new Object[] { GET_MIS_SESSIONID}, e);
+	} catch (TransformerException e) {
+		throw new AuthenticationException("auth.16", new Object[] { GET_MIS_SESSIONID}, e);
+	}
+    
+    
 	if (oaParam.getProvideFullMandatorData()) {
 		try {
 	    	// set extended SAML attributes if provideMandatorData is true
@@ -1072,6 +1088,32 @@ public class AuthenticationServer implements MOAIDAuthConstants {
     
   }
   
+  /**
+   * Verifies the infoboxes (except of the  identity link infobox) returned by the BKU by 
+   * calling appropriate validator classes.
+   * 
+   * @param session The actual authentication session.
+   * @param mandate   The Mandate from the MIS
+   * 
+   * @throws AuthenticationException 
+   * @throws ConfigurationException  
+ * @throws TransformerException 
+ * @throws ParserConfigurationException 
+ * @throws IOException 
+ * @throws SAXException 
+   */
+  private void setExtendedSAMLAttributeForMandatesOID(
+    AuthenticationSession session, MISMandate mandate, boolean business) 
+  throws ValidateException, ConfigurationException, SAXException, IOException, ParserConfigurationException, TransformerException
+  {
+    
+	  ExtendedSAMLAttribute[] extendedSamlAttributes = addExtendedSamlAttributesOID(mandate, business);
+	  
+	  
+	  AddAdditionalSAMLAttributes(session, extendedSamlAttributes, "MISService", "MISService");
+    
+  }
+  
   /**
    * Intermediate processing of the infoboxes. The first pending infobox 
    * validator may validate the provided input
@@ -1259,6 +1301,38 @@ public class AuthenticationServer implements MOAIDAuthConstants {
 
     
     
+  	}
+  
+  /**
+   * Adds the AUTH block related SAML attributes to the validation result. 
+   * This is needed always before the AUTH block is to be signed, because the 
+   * name of the mandator has to be set
+ * @throws ParserConfigurationException 
+ * @throws IOException 
+ * @throws SAXException 
+ * @throws TransformerException 
+   */
+  private static ExtendedSAMLAttribute[] addExtendedSamlAttributesOID(MISMandate mandate, boolean business) throws SAXException, IOException, ParserConfigurationException, TransformerException {
+    
+	  Vector extendedSamlAttributes = new Vector(); 
+	  
+	  
+	  extendedSamlAttributes.clear();
+    
+	  String oid = mandate.getProfRep();
+	  
+	  if (oid != null) {
+		  String oidDescription = mandate.getTextualDescriptionOfOID();
+		  extendedSamlAttributes.add(new ExtendedSAMLAttributeImpl(ParepValidator.EXT_SAML_MANDATE_OIDTEXTUALDESCRIPTION, oidDescription, SZRGWConstants.MANDATE_NS, ExtendedSAMLAttribute.NOT_ADD_TO_AUTHBLOCK));
+	  }
+    	
+	  ExtendedSAMLAttribute[] ret = new ExtendedSAMLAttribute[extendedSamlAttributes.size()];
+	  extendedSamlAttributes.copyInto(ret);
+	  Logger.debug("ExtendedSAML Attributes: " + ret.length);
+	  return ret;
+
+    
+    
   	}
   
   /**
-- 
cgit v1.2.3