05 Exercise - Add a user via the md5passwd tool
Exercise
This page is a different kind of uPortal manual page, a hands-on exercise. It may be helpful to you to use this exercise in the context of this manual. It also may serve as a template for building uPortal training materials.
Purpose of this exercise
This exercise adds a new user to uPortal's internal set of locally managed login credentials.
This exercise helps introduce uPortal's command line tooling implemented via Ant and Maven and exercises this tooling to ensure it is properly configured..
Pre-requisites for this exercise
- A working, installed, suitable instance of uPortal 3 (e.g., that provided by the uPortal Quickstart distribution)
Stepwise instructions
Step 1: Navigate to the uPortal 3 directory
Supposing you've unzipped the Quickstart into /up3 : Rather than running Ant in the /up3/uPortal-3.0.0-quick-start/ directory, run it in /up3/uPortal-3.0.0-quick-start/uPortal-3.0.0 , so that instead of running Ant on the build.xml at /up3/uPortal-3.0.0-quick-start/build.xml, run Ant on the build.xml at /up3/uPortal-3.0.0-quick-start/uPortal-3.0.0/build.xml .
cd /up3/uPortal-3.0.0-quick-start/uPortal-3.0.0
Step 2: Run the Ant tool on the build.xml in the uPortal 3 directory
As an example, ask Ant to enumerate the targets it can run in this context. The -p flag enumerates the targets available for the in-context project.
/uP3/uPortal-3.0.0-quick-start/apache-ant-1.6.5/bin/ant -p
andrew-petros-macbook:~ apetro$ cd /up3/uPortal-3.0.0-quick-start/uPortal-3.0.0/ andrew-petros-macbook:uPortal-3.0.0 apetro$ ../ant.sh -p Buildfile: build.xml Main targets: addstylesheet Registers a new theme or structure clean Removes the deployed uPortal from the container and runs 'mvn clean' clean-shared Removes the ALL shared libraries from the container. crn-delete Deletes the specified entity crn-export Exports the specified entity or entities to XML on the file system crn-import Imports the specified XML file or files crn-make-data-xml Runs the DbUnload tool against all tables listed in data.xml db Loads database tables and data db-hibernate Drops then creates Hibernate managed tables dbtest Displays information about the database defined in rdbm.properties dbunload Dumps a database table to a flat file in XML format delstylesheet Deletes an existing theme or structure deluser Delete traces of a user from the portal database deploy-ear Deploy uPortal and dependent libraries and portlets to the servlet container deploy-war Deploy the uPortal web application to the servlet container deployPortletApp Deploys a portlet application help Prints information about using this ant build file. hsql Start a HSQLDB instance consistent with the default RDBMS requirements of uPortal hsql-shutdown Compacts then cleanly shuts down hsql, useful if the 'hsql' task was run with '-Dspawn=true' i18n-db Loads internationalization tables and data initportal Runs all the targets necessary to deploy the portal and prepare the portal database l10n-db Loads localized data md5passwd Creates a user in the UP_PERSON_DIR table modstylesheet Modifies an existing theme or structure regchantype Registers a new channel type Default target: help
Step 3: Try it out
Add a new user named "seminar" with password "howdy."
This user appears in other exercises
It is important for subsequent exercises that this user not have a password equal to its name, so don't set the password to "seminar".
/uP3/uPortal-3.0.0-quick-start/apache-ant-1.6.5/bin/ant md5passwd -Dusername=seminar
Notice that the Ant target is named "md5passwd". It is so named because what it is doing is creating an md5-hashed password entry in uPortal's internal user account table.
It takes a single parameter (that's defined with the -D) of "username", here set to value "seminar", since "seminar" will be the name of this example user.
It will run for a bit and then prompt you for the password for this new user. Here's an example run:
andrew-petros-macbook:uPortal-3.0.0 apetro$ /uP3/uPortal-3.0.0-quick-start/apache-ant-1.6.5/bin/ant md5passwd -Dusername=seminar Buildfile: build.xml md5passwd: [echo] Invoking Md5Passwd [java] Working directory ignored when same JVM is used. [java] Enter Password for seminar:
Here it's waiting for the password. Type the desired password, press enter, and it will continue:
howdy [java] Password Updated... BUILD SUCCESSFUL Total time: 44 seconds andrew-petros-macbook:uPortal-3.0.0 apetro$
Step 4: Try logging in as the created user
Visit your uPortal and attempt to login as seminar / howdy .