# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
#
# The contents of this file are subject to the terms
# of the Common Development and Distribution License
# (the License). You may not use this file except in
# compliance with the License.
#
# You can obtain a copy of the License at
# See the License for the specific language governing
# permission and limitations under the License.
#
# When distributing Covered Code, include this CDDL
# Header Notice in each file and include the License file
# at opensso/legal/CDDLv1.0.txt.
# If applicable, add the following below the CDDL Header,
# with the fields enclosed by brackets [] replaced by
# your own identifying information:
# "Portions Copyrighted [year] [name of copyright owner]"
#
# $Id
#
#########################################################################
#
# This is a convenient script for federating users in a bulk manner.
#
# The script assumes that the backend user database is LDAP compliant
# and the OpenSSO as the federation software provider.
#
# This script expects userdn mappins file as the primary input for creating
# federation data for the users specified in the file. The userdns must be
# separated by "|" and must be in the order of spuser followed by an idpuser.
# For e.g.
# uid=spuser,dc=iplanet,dc=com | uid=idpuser,dc=iplanet,dc=com
#
# This script generates unique random identifiers for each user mapping
# and creates four different files namely:
# spuserdata.ldif and idpuserdata.ldif.
#
# This will also load federation data (*.ldif file) locally based on the
# given provider role. For e.g. if the local provider role is "SP", this
# will load spuserdata.ldif locally or idpuserdata.ldif for IDP role.
#
# The idpuserdata.ldif/spuserdata.ldif files will also be stored locally for
# convenient loading using ldapmodify command if the remote provider is
# also an OpenSSO instance.
#
# If the remote provider is not an OpenSSO instance, the generated
# files
# spnameidentifies.txt/idpnameidentifies.txt can be exchanged to the second
# party so that it can generate federation/user specific data based on
# this input.
#
#########################################################################
if [ "$OSTYPE" = "Linux" ]; then
OMIT=''
else
OMIT='\c'
fi
$ECHO "`$gettext ' ' `$0 [ -u | --user ] [ -w | --passfile ] [ -h | --host ] [ -p | --port ] [ -r | --role ] [ -s | --spid ] [ -i | --idpid ] [-f | --file]"
}
}
while [ 1 ]
do
stty -echo
read password
stty -echo
read password1
if [ $password = $password1 ];then
return
else
fi
done
}
# Main starts here.
role=""
user=""
pfile=""
file=""
host=""
port=""
spproviderid=""
if [ $# -eq 0 ]
then
exit 1
fi
while [ $# -ne 0 ]
do
case "$1" in
"-r" | "--role")
if [ "$2" != "SP" ] && [ "$2" != "IDP" ]; then
exit 1
else
role=$2
fi
shift
;;
"-u" | "--user")
if [ "$2" = "" ]; then
exit 1
fi
user=$2
shift
;;
"-w" | "--passfile")
if [ "$2" = "" ]; then
exit 1
fi
pfile=$2
shift
;;
"-h" | "--host")
if [ "$2" = "" ]; then
exit 1
fi
host=$2
shift
;;
"-p" | "--port")
if [ "$2" = "" ]; then
exit 1
fi
port=$2
shift
;;
"-V" | "--version")
exit 0
shift
;;
"-s" | "--spid")
if [ "$2" = "" ]; then
exit 1
fi
spproviderid=$2
shift
;;
"-i" | "--idpid")
if [ "$2" = "" ]; then
exit 1
fi
shift
;;
"-f" | "--file")
if [ "$2" = "" ]; then
exit 1
fi
file=$2
shift
;;
*)
exit 1
;;
esac
shift
done
if [ "$pfile" = "" ]; then
else
fi
# Check for the non-null values
exit 1
fi
if [ "$host" = "" ]; then
host="localhost"
fi
if [ "$port" = "" ]; then
host="389"
fi
exit 1
fi
if [ ! -f $GENERATE_NI ] && [ ! -f $GENERATE_LDIF ]; then
exit 1
fi
if [ $? != 0 ]; then
exit 1
fi
if [ -f spuserdata.ldif ]; then
fi
if [ -f idpuserdata.ldif ]; then
fi
if [ "$role" = "SP" ]; then
if [ $? != 0 ]; then
exit 1
fi
if [ $? != 0 ]; then
exit 1
fi
if [ $? != 0 ]; then
exit 1
fi
exit 0
fi
if [ "$role" = "IDP" ];then
if [ $? != 0 ]; then
exit 1
fi
if [ $? != 0 ]; then
exit 1
fi
if [ $? != 0 ]; then
exit 1
fi
exit 0
fi