'SAP Portal 7.3'에 해당되는 글 2건

  1. 2012.05.10 Customizing Logon Page on Portal 7.3
  2. 2011.11.29 Using reCaptcha at SAP Portal 7.3 Logon Page
Technique/그외2012. 5. 10. 20:49

Customizing Logon Page on Portal 7.3

Posted by purav mehta in SAP NetWeaver Portal on May 10, 2012 12:59:15 PM

Please find below details steps for customizing logon page on Portal 7.3.

 

1Locate the WAR file.

 

First step is to get the WAR file delievered by SAP for logon page to customize it.

 

 

Copy the war file tc~sec~ume~logon~ui.war to your local machine from

 

<Installation drive>:\usr\sap\<SID>\J00\j2ee\cluster\apps\sap.com\com.sap.security.core.logon
\servlet_jsp\logon_ui_resources\tc~sec~ume~logon~ui.war

 

 

2. Import the WAR file

 

Next we have to import the WAR file into NWDS by going to: File --> Import -->Web --> War File

 

1.jpg

 

     Select the WAR file from the local system.

 

2.jpg

 

 

    As EAR format can be deployed on JEE server, corresponding EAR project has to be created.

   For this, check the “Add project to an EAR “checkbox as above and specify suitable name in “EAR project name “based on the

   WAR project name.

 

   Click Finish to create both WAR and EAR projects.

 

 

 

3.jpg

 

    Expand the WAR project.

 

 

4.jpg

 

At this point you will notice errors in the project. To remove these errors follow the next step.

 

 

3Adding the required JAR file to remove the Errors.

 

 

     a. Next you need to locate the Jar file “tc~sec~ume~logon~logic_api.jar” on which the WAR file is dependent from the following location:

     <drive>\usr\sap\<SID>\J00\j2ee\cluster\apps\sap.com\com.sap.security.core.logon\servlet_jsp\logon_app\root\WEB-INF\lib

 

    

     Copy the tc~sec~ume~logon~logic_api.jar” file to the WebContent\WEB-INF\lib folder of the WAR project in NWDS.

 

5.jpg

 

    bThis Jar file has also to be added in the build path of WAR file.

         Right Click the WAR project and select Build Path --> Configure Build Path.

 

6.jpg

 

 

     cClick on Libraries tab.Click on “Add External  Jars”  and select the JAR file “tc~sec~ume~logon~logic_api.jar” from local system and “Add” to   get   the following screen:

 

7.jpg

 

Once done you will notice that all errors have gone !!

 

4. Make Changes to Layout

 

     a.  Now its time to start making the desired changes to the layout. In our example we are changing the branding image

          on the Logon screen. We have copied the image “hearts.jpg” to the folder WebContent\layout

 

 

 

8.jpg

 

SAP delivered image  branding-image-portals.jpg has dimension  290X360 px . If you select a bigger image it will get truncated based on the mentioned dimensions. To change the dimensions you need to edit the element urBrandImage in css file

 

 

urBrandImage{overflow:hidden;width:290px;height:360px}

 

 

 

b. After the changes have been made, we need to be sure that WAR project is updated in the EAR project and latest changes are

   picked up. For this Right Click on WAR project and select Java EE Tools -->Update EAR Libraries.

 

 

9.jpg

 

 

 

5. Configuring deployment descriptors

         

          Next we need to configure 2 deployment descriptors of the EAR application as below:

         

          a. application-j2ee-engine.xml

          b. application.xml

 

 

10.jpg

 

     a.  Configuring application-j2ee-engine.xml

 

 

 

        In the EAR, view the General tab of the file <project_name>/EARContent/META-INF/application-j2ee-engine.xml.

 

          i. Enter a provider name for your application.This is usually domain name of the client.

             The provider name defines your namespace where your applications reside on the AS Java.

              If you enter “example.com”, the application deploys to the following path:<ASJava_Installation>/j2ee/cluster/apps/example.com/<project_name>

 

        ii . Next we need to add reference to the standard application com.sap.security.core.logon

               Choose References and choose +  with the quick info text Add element

 

         iii.  Choose Create new and enter the required data.

 

   

Reference Data for the Logon Application

Field Name

Data

Reference target

com.sap.security.core.logon

Reference type

hard

Reference target type

application

Provider name

sap.com

 

11.jpg

 

This will generate the XML in background which can be displayed in the SOURCE tab :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<application-j2ee-engine

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">

      <reference

            reference-type="hard">

            <reference-target

                  provider-name="sap.com"

                  target-type="application">com.sap.security.core.logon</reference-target>

      </reference>

      <provider-name>newLogon.com</provider-name>

</application-j2ee-engine>

 

  b.. Configuring application.xml

 

In the EAR, edit the file <project_name>/EARContent/META-INF/application.xml, and define the URL alias and for your custom logon UI.

Double click on application.xml and go to Modules tab . Select the WAR file and enter the “Context Root” field for example : new_logon

 

12.jpg

 

We have to provide this alias name later in NWA so please make a note of it.

 

 

 

6. Creating the deployable EAR file

 

     Next we need to create a deployable EAR file . For this right Click on EAR project and select Export -->SAP EAR file

 

13.jpg

 

7. Deploying the EAR file

 

     Right click on the EAR project and select Run As --> Run on server

     Enter the credentials of the server and file will get deployed on the server with a success message.

     You might get an Error screen in NWDS after deployment as below however you can ignore it.

 

 

 

14.jpg

 

8. Configuring UME properties in NWA

 

     Navigate to the following URL to modify UME properties through Netweaver Administrator

     http://<host>:<port>/nwa/auth

 

     a. Change the property Alias of the aplication for customizing login pages (ume.logon.application.ui_resources_alias)                

          to custom  application “ new_logon” which we mentioned previously  in the Context root of application.xml

 

 

     b.  Change the property Path or URL to the branding image (ume.logon.branding_image) to “layout/hearts.jpg”

 

 

15.jpg

16.jpg

 

 

Hurray!!!  We have successfully customized the Logon Screen …

 

 

9. Next aim is to have a custom text or Notice on the logon page. 

 

Please add the following code after line 44 in the logon.jsp.

 

<!-- ********************************************* -->

    <!--  disclaimer notice                         -->

                <tr>

      <td class="urLblStdNew">

        <span ><b>Notice for All Users</b>

                      <br><br>Paste your content here.

        </span>

      </td>

    </tr>    

<!-- ********************************************* -->

 

Save the new values and restart the portal server.

 

 

17.jpg

 

 

18.jpg

 

This finishes (or rather begins) our journey with the customization of Logon page …. !!!




http://scn.sap.com/community/netweaver-portal/blog/2012/05/10/customizing-logon-page-on-portal-73?utm_source=twitterfeed&utm_medium=twitter

Posted by AgnesKim
Technique/그외2011. 11. 29. 13:36

Using reCaptcha at SAP Portal 7.3 Logon Page
Erhan Keseli Active Contributor Bronze: 250-499 points
Business Card
Posted on Nov. 28, 2011 05:19 AM in Enterprise Portal (EP)

 
 

If you have a portal which exposed to internet, you may want to use captcha for bots. So in this blog I will implement reCaptcha. Why do I choose reCaptcha? Because it is easy to implement and you dont need to implement a lot of things to work. Let's do it!

First you have to modify logon page. You can find it solution here: http://nwturk.com/blog/2011/06/06/changing-logon-page-on-netweaver-7-3/

You have to import jar files of reCaptcha (link). After importing files modify logonPage.jsp file for reCaptcha.

-Import reCaptcha:

<%@ page import="net.tanesha.recaptcha.ReCaptcha" %>
<%@ page import="net.tanesha.recaptcha.ReCaptchaFactory" %>

-Add reCaptcha code for displaying captcha. You can customize it for your need:

<%
	ReCaptcha c = ReCaptchaFactory.newReCaptcha("your public key", "your private key", false);
	out.print(c.createRecaptchaHtml(null, null));
%>

Be careful adding these code block between <sap:form type="logon"></sap:form>

We have done about this part. Now it is time to implement login module. You can get more information about login modules from this link. Now you have more information about login modules after link. Implement the class and add a new method to get response.

	private String getRequestValue(String parameterName)
		throws LoginException {

		HttpGetterCallback httpGetterCallback = new HttpGetterCallback();
		httpGetterCallback.setType(HttpCallback.REQUEST_PARAMETER);
		httpGetterCallback.setName((String) parameterName);

		String value = null;

		try {
			_callbackHandler.handle(new Callback[] { httpGetterCallback });

			String[] arrayRequestparam =
				(String[]) httpGetterCallback.getValue();

			if (_decodeRequestParameter) {
				value = URLDecoder.decode(arrayRequestparam[0], "UTF-8");
			} else {
				value = arrayRequestparam[0];
			}

		} catch (UnsupportedCallbackException e) {

			return null;

		} catch (IOException e) {
			throwUserLoginException(e, LoginExceptionDetails.IO_EXCEPTION);
		}

		return value;
	}

You can call method with these parameters. (example: String challengefield = getRequestValue("recaptcha_challenge_field");

And also you need client ip address. Here is the moethod to get ip address:

	private String getIPAddress(){
		String clientIp = "";
		try{
			HttpGetterCallback hgc = new HttpGetterCallback();
			_callbackHandler.handle(new Callback[] { hgc });
			hgc.setType(HttpCallback.CLIENT_IP);
			clientIp = (String)hgc.getValue();
		}catch(Exception ex){

		}
		return clientIp;
	}

 

If you have a reverse proxy you get ip address of it. So you have to configure it to get clients ip address.
After you get the parameters for reCaptcha check them:

import net.tanesha.recaptcha.ReCaptchaImpl;
import net.tanesha.recaptcha.ReCaptchaResponse;
ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
reCaptcha.setPrivateKey("your_private_key");
String ipAdress = getIPAddress();
String challenge = getRequestValue("recaptcha_challenge_field");
String uresponse = getRequestValue("recaptcha_response_field");
ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(ipAdress, challenge, uresponse);
if (reCaptchaResponse.isValid()) {
	// do your valid login work
}else{
    // do your invalid login work
}

Erhan Keseli  Active Contributor Bronze: 250-499 points is an Senior SAP Technical Consultant specialized on Netweaver Technology.


http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/27537%3Futm_source%3Dtwitterfeed%26utm_medium%3Dtwitter%26utm_campaign%3DFeed%253A+SAPNetworkWeblogs+%2528SAP+Network+Weblogs%2529

Posted by AgnesKim