Wednesday, August 29, 2012

How to Implement Application Integrator and Use SSO through User Mapping


How to Implement Application Integrator and Use SSO through User Mapping


Following are the steps to achieve SSO(Single sign on) with User Maping using Application Integrator.

Step1:
Download the AppIntegrator zip file from the SAP Service Market Place .
Here Go to the quick link "solutions" and advance search for the words "using the application integrator" with quotes.Right click on the zip icon of the document named Using the Application Integratorand save it to the local directory. 

Step2:
Upload the com.sap.portal.howtos.webapp.par file into the SAP Enterprise Portal
System Administration -> Support -> Portal Runtime -> Administration Console.
Browse till the location and then Upload.


Step3:
Now, create a new System Template from the com.sap.portal.howtos.webapp.par file
System Administration -> System Configuration -> System Landscape -> Portal Content ->(Right Click) on Any Folder and select New From PAR -> System (from PAR)


Select the radiobutton com.sap.portal.howtos.webapp PAR and then Next.


Select the WebApplication Portal Component and then NEXT.


Enter all the required fields System Name, System ID, etc., and then Next-> Finish->Finish ->Ok


Change the Property Category ‘ Is a Template ‘ to YES , to convert the created System as a System Template so that it can be reused .Save the Changes and close the wizard


Step4:
Create a new System using the above created Web Application Template
System Administration -> System Configuration -> System Landscape -> Portal Content ->Right Click on Any Folder and select New -> System(From Template) -> Refresh the list once.

Select the System Template which was just created i.e., <Name of the system u created in previous step> and then Next
Enter all the required fields System Name, System ID, etc., and then Next -> Finish -> Select Open the Object for Editing then Ok -> From the Property Category select System Definition.


Enter the following and save the changes
Name of the Server : (url for the required webpage )
Protocol of Target system : (whether it is http or https)
URI of Web Application : (login page extension for url)
Step5:

Now go to Property Category again and select UserManagement.

Enter the following and save the changes
Logon Method : UIDPW
User Mapping Type : admin, user
Step6:
From the Display dropdownlistbox select System Aliases.


Enter the System Alias name and ADD it as a default alias and Save the changes made.
And now GOTO the Personalize link and enter the User Mapping fields(Userid for that particular website and password). Save and close the window.

Step7:
Create an iView : Go to Content Administration -> Portal Content -> Portal Content ->Right Click on Any Folder and select New From PAR -> iView.
Select the com.sap.portal.appintegrator.sap PAR file and then Next. Select Generic as the Portal Component and then Next. Enter all the required fields iView Name, iView ID, etc., and then Next -> Finish -> Select Open the Object for Editing-> OK.

From the Property Category , select Content-Generic Launcher -> Enter the Following
System : your system alias name you created through previous step.
URI Template : <System.protocol>://<System.server><System.uri>?action=submitform&user=<User.LogonUid>&password=<User.LogonUid>

Here the ‘user’ , ‘password’ are the attribute names which are fetched from the view/source of the websites’ login page
Save the Changes made and Click on the Preview button in the wizard and You have entered desired site without being asked the username and password.

Hence we have achieved the Single Sign-On through User Mapping.

User Management Scheduler - Scheduler for creating Users


User Management Scheduler

Step 1: Create a Project, through: File-> New-> Other


Step 2: Navigate to Portal Application-> Create a Portal Application Object.-> Next

Step 3: Give the project name : UserManagementScheduler and choose the location where you want to create the application. → Finish


Step 4: Now, create a template for your job through → Right click on src.comp-> New-> Other


Step 5: Select Repository Framework 7.1.5 → Scheduler Task Wizard-> Next

Step 6: Give your class name, package and Eclipse Project Name → Finish



Step 7: Right click on your project → Properties

Step 8: select Java Build Path → under Libraries tab → Click Add Variable



Step 9: Select ECLIPSE_HOME → Extend → Plugins → com.sap.km.rfwizard_7.1.5 → lib → bc.crt_api.jar → OK → OK → OK and also include bc.sf.service.scheduler_api.jar file the same way.

Step 10: Open create.java file and write following code under run method:
java.util.Date currentDt = new java.util.Date();
String TimeStamp=currentDt.getDate()+"_"+(currentDt.getMonth()+1)+"_"+(currentDt.getYear()+1900+"__"+currentDt.getHours()+"_"+currentDt.getMinutes()+"_"+currentDt.getSeconds());

String month="",datee="";

if((currentDt.getMonth()+1) <=9)
{ month="0"+(currentDt.getMonth()+1); }
else
{ month=""+(currentDt.getMonth()+1); }

if((currentDt.getDate()) <=9)
{ datee="0"+(currentDt.getDate()); }
else
{ datee=""+(currentDt.getDate()); }

String tstamp=(currentDt.getYear()+1900)+""+month+""+datee;

FileOutputStream outS,outE,outEX;
PrintStream PS,PE,PEX;

String UserId = "", lineVal="",FirstName = "",LastName = "",Salution = "",Group = "",Role = "";
try
{
StringBuffer contents= new StringBuffer();
StringBuffer error= new StringBuffer();
BufferedReader input = null;
try
{
outS = new FileOutputStream("/User_Enable/AutoCreLog_"+TimeStamp+".txt");
outE = new FileOutputStream("/User_Enable/CreErrorLog_"+TimeStamp+".txt");
PS= new PrintStream(outS);
PS.println("User Log: "+ currentDt);
PS.println("User Log: "+tstamp);
String filePath="/User_Enable/AUC_"+tstamp+".txt";
String uid="";
File testFile = new File(filePath);
input = new BufferedReader( new FileReader(testFile) );
String line = null; //not declared within while loop

while (( line = input.readLine()) != null)
{
ArrayList val = new ArrayList();
contents= new StringBuffer();
contents.append(line);
uid=contents.toString();
PS.println(uid+" from "+filePath);
StringTokenizer st = new StringTokenizer(line,"\t");
while (st.hasMoreTokens())
{
val.add(st.nextToken());
}

for(int i=0; i<val.size();i=i+3)
{
UserId = val.get(i).toString().trim();
FirstName = val.get(i+1).toString().trim();
LastName = val.get(i+2).toString().trim();
try
{
IUserFactory factory = UMFactory.getUserFactory();
IUserAccountFactory accountFactory = UMFactory.getUserAccountFactory();
IUserMaint newUser = factory.newUser(UserId);
newUser.setFirstName(FirstName);
newUser.setLastName(LastName);
newUser.save();
newUser.commit();
newUser.addToGroup("GRUP.PRIVATE_DATASOURCE.un:Client ESS Users");
IUserAccount account =accountFactory.newUserAccount(UserId,newUser.getUid());
account.save();
account.setPassword("client1234");
account.setPasswordChangeRequired(true);
account.commit();
PS.println(account.getLogonUid() + " Created Successfully");
}
catch (Exception e)
{
PE = new PrintStream(outE);
PE.println("Error Log " + currentDt);
PE.println(e.getMessage() + "\n");
}
}
}
input.close();
}
catch (Exception ex)
{
try
{
outE = new FileOutputStream("/User_Enable/FileNotFoundLog_"+TimeStamp+".txt");
PE= new PrintStream(outE);
PE.println("Error Log "+currentDt+"...."+ex+"...");
}
catch(Exception ext)
{
ext.printStackTrace();
input.close();
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}

Step 11: Build your component and deploy your par and then navigate to following location in portal.
System Administration → System Configuration → Knowledge Management → Configuration → Content Management → Global Services → Scheduler Tasks.
Step 12: You will see your task. Click on it and schedule it to run at a particular time. You can define your new periodic time as well.

Select the time you want to schedule and then click on Apply and OK. In my case am running it every day as 10 am.

Work Protect Mode settings in EP 7.3: for getting rid of views getting opened in separate Windows



                            Accessing Portal Services in SAP NetWeaver Administrator


Some portal applications require specific, non-default settings to their associated services, which reside on AS Java. The configuration of services takes place in the SAP NetWeaver Administrator tool.

Note

The following procedure describes only where you find services and their properties in NetWeaver Administrator; for more detailed functional information, relating to this procedure, see Viewing Web Modules Configuration. For more information about SAP NetWeaver Administrator, see SAP NetWeaver Administrator.

In general, the properties, which are configurable in SAP NWA, belong to additional services, such as portal or Web Dynpro services. These are not to be confused with core AS Java services, which are configured in the AS Java Config Tool.

End of the note.

Procedure

Open the SAP NetWeaver Administrator to the Application Modules page as follows:

The recommended method of access is to add the quick link /app-modules to the NWA URL, (hostname:port/nwa/app-modules).

It is also possible to navigate to the Application Modules page:

Add nwa to the AS Java URL to access SAP NetWeaver Administrator. (hostname:port/nwa) and then go to  Configuration  Infrastructure  and click the Application Modules link.

The Application Modules: Overview window opens.



Search for : epcf.loader ->press enter


Portal applications are Web or application modules; they appear under the Name column in the modules lists. The corresponding Java application is listed under the Application column in the Web module details list.

In the Module List, find the desired application and select it. This updates the Web Module Details pane below, in which you can see the services of the current application (in the Components tab).

To find the application module more easily:


Click Filter to enable filtering by column (a text box appears above each column); you can now write the name of your portal application above the Name column and press ENTER.

Continue to step 4.

In the Web Module Details pane, select the desired service to view its properties in the Portal Service Details pane below.

In the Portal Service Details pane, change property values as required by typing directly in the property field.

Note

Not all the properties of any given service are editable; such property fields are inactive.

End of the note.
You can also click Restore Default to return to initial values.

After making all the desired changes, click Save in the Web Module Details pane.




Note

Saveing takes place on the Web Module level. You can, therefore, modify the properties of any number of services and save when you are finished.

Even if your only modification is to restore default value to properties, you must save the change.

End of the note.
Restart the service.

On the Module List, choose More Actions and then choose View corresponding to application.

In the displayed application list, make sure the relevant application is selected and choose Restart.