diff options
| author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-03-14 11:40:13 +0100 | 
|---|---|---|
| committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-03-14 11:40:13 +0100 | 
| commit | b01fc5becad147315bbd8d168f5435ee126e638d (patch) | |
| tree | 981f82a60365af9ce0e2526cc5240c8263a2c5df /id/server/idserverlib | |
| parent | f67427831d1f8c49ce6c474691b880d90a42b584 (diff) | |
| download | moa-id-spss-b01fc5becad147315bbd8d168f5435ee126e638d.tar.gz moa-id-spss-b01fc5becad147315bbd8d168f5435ee126e638d.tar.bz2 moa-id-spss-b01fc5becad147315bbd8d168f5435ee126e638d.zip | |
add independent mandate-service selection step to choose between MIS and ELGA mandate-service
Diffstat (limited to 'id/server/idserverlib')
2 files changed, 161 insertions, 11 deletions
| diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java index f91dc6d3e..69c155c1e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java @@ -78,20 +78,20 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{  		//check UseMandate flag -		String useMISMandateString = null; -		boolean useMISMandateBoolean = false; +		String useMandateString = null; +		boolean useMandateBoolean = false;  		if ((useMandate != null) && (useMandate.compareTo("") != 0)) { -			useMISMandateString = useMandate; +			useMandateString = useMandate;  		} else { -			useMISMandateString = "false"; +			useMandateString = "false";  		} -		if (useMISMandateString.compareToIgnoreCase("true") == 0) -			useMISMandateBoolean = true; +		if (useMandateString.compareToIgnoreCase("true") == 0) +			useMandateBoolean = true;  		else -			useMISMandateBoolean = false; +			useMandateBoolean = false; -		moasession.setUseMandate(useMISMandateString); +		moasession.setUseMandate(useMandateString);  	    //load OnlineApplication configuration @@ -155,7 +155,7 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{  		} else {  			Logger.debug("Service-Provider is of type 'PrivateService' with DomainIdentifier:" + oaParam.getIdentityLinkDomainIdentifier()); -			if (useMISMandateBoolean) { +			if (useMandateBoolean) {  				Logger.error("Online-Mandate Mode for business application not supported.");  				throw new AuthenticationException("auth.17", null);  			} @@ -213,8 +213,8 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{  			protocolReq.setNeedSingleSignOnFunctionality(false);  		} -		if (protocolReq.needSingleSignOnFunctionality() && useMISMandateBoolean) { -			Logger.info("Usage of MIS-MandateService does not allow Single Sign-On. --> SSO is disabled for this request."); +		if (protocolReq.needSingleSignOnFunctionality() && useMandateBoolean) { +			Logger.info("Usage of Mandate-Service does not allow Single Sign-On. --> SSO is disabled for this request.");  			protocolReq.setNeedSingleSignOnFunctionality(false);  		} diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GUILayoutBuilderServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GUILayoutBuilderServlet.java new file mode 100644 index 000000000..09b344f9d --- /dev/null +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GUILayoutBuilderServlet.java @@ -0,0 +1,150 @@ +/* + * Copyright 2014 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.auth.servlet; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringEscapeUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import at.gv.egovernment.moa.id.auth.frontend.builder.IGUIFormBuilder; +import at.gv.egovernment.moa.id.auth.frontend.builder.ServiceProviderSpecificGUIFormBuilderConfiguration; +import at.gv.egovernment.moa.id.auth.servlet.AbstractController; +import at.gv.egovernment.moa.id.commons.MOAIDAuthConstants; +import at.gv.egovernment.moa.id.commons.api.AuthConfiguration; +import at.gv.egovernment.moa.id.commons.api.IRequest; +import at.gv.egovernment.moa.id.moduls.IRequestStorage; +import at.gv.egovernment.moa.id.util.HTTPUtils; +import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.util.MiscUtil; + +/** + * @author tlenz + * + */ +@Controller +public class GUILayoutBuilderServlet extends AbstractController { + +	public static final String ENDPOINT_CSS = "/css/buildCSS"; +	public static final String ENDPOINT_JS = "/js/buildJS"; +	 +	@Autowired AuthConfiguration authConfig; +	@Autowired IRequestStorage requestStoreage; +	@Autowired IGUIFormBuilder formBuilder; +	 +	public GUILayoutBuilderServlet() { +		super(); +		Logger.debug("Registering servlet " + getClass().getName()  +				+ " with mappings '" + ENDPOINT_CSS  +				+ "' and '" + ENDPOINT_JS + "'."); +		 +	} +	 +	@RequestMapping(value = "/css/buildCSS", method = {RequestMethod.GET}) +	public void buildCSS(HttpServletRequest req, HttpServletResponse resp) throws IOException {		 +		try { +			IRequest pendingReq = extractPendingRequest(req); +		 +			//initialize GUI builder configuration +			ServiceProviderSpecificGUIFormBuilderConfiguration config = null; +			if (pendingReq != null)  +				config = new ServiceProviderSpecificGUIFormBuilderConfiguration( +						pendingReq,  +						ServiceProviderSpecificGUIFormBuilderConfiguration.VIEW_TEMPLATE_CSS,  +						null); +			 +			else +				config = new ServiceProviderSpecificGUIFormBuilderConfiguration( +						HTTPUtils.extractAuthURLFromRequest(req),  +						ServiceProviderSpecificGUIFormBuilderConfiguration.VIEW_TEMPLATE_CSS,  +						null); +		 +			//build GUI component +			formBuilder.build(resp, config, "text/css;charset=UTF-8", "CSS-Form"); +			 +		} catch (Exception e) { +			Logger.warn("GUI ressource:'CSS' generation FAILED."); +			resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Created resource failed"); +		} +							 +	} +	 +	@RequestMapping(value = "/js/buildJS", method = {RequestMethod.GET}) +	public void buildJavaScript(HttpServletRequest req, HttpServletResponse resp) throws IOException { +		try { +			IRequest pendingReq = extractPendingRequest(req); +		 +			//initialize GUI builder configuration +			ServiceProviderSpecificGUIFormBuilderConfiguration config = null; +			if (pendingReq != null)  +				config = new ServiceProviderSpecificGUIFormBuilderConfiguration( +						pendingReq,  +						ServiceProviderSpecificGUIFormBuilderConfiguration.VIEW_TEMPLATE_JS,  +						null); +			 +			else +				config = new ServiceProviderSpecificGUIFormBuilderConfiguration( +						HTTPUtils.extractAuthURLFromRequest(req),  +						ServiceProviderSpecificGUIFormBuilderConfiguration.VIEW_TEMPLATE_JS,  +						null); +		 +			//build GUI component +			formBuilder.build(resp, config, "text/javascript;charset=UTF-8", "JavaScript"); +			 +		} catch (Exception e) { +			Logger.warn("GUI ressource:'JavaScript' generation FAILED."); +			resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Created resource failed"); +		} +						 +	} +	 +	private IRequest extractPendingRequest(HttpServletRequest req) { +		try {		 +			String pendingReqID = StringEscapeUtils.escapeHtml( +					req.getParameter(MOAIDAuthConstants.PARAM_TARGET_PENDINGREQUESTID)); +		 +			if (MiscUtil.isNotEmpty(pendingReqID)) {		 +				IRequest pendingReq = requestStorage.getPendingRequest(pendingReqID); +				if (pendingReq != null) { +					Logger.trace("GUI-Layout builder: Pending-request:" +							+ pendingReqID + " found -> Build specific template"); +					return pendingReq; +					 +				}			 +			} +			 +			Logger.trace("GUI-Layout builder: No pending-request found -> Use default templates"); +			 +		} catch (Exception e) { +			Logger.warn("GUI-Layout builder-servlet has an error during request-preprocessing.", e); +		}	 +		 +		return null; +	} +} | 
