3 JAVA=${JAVA_HOME}/bin/java
4 DEFAULT_DOMAIN=XXX_DOMAIN
6 # Give some help hints if first run
8 if [ "`declare -f aaflogout`" = "" ] || [ "$1" = "-h" ]; then
11 echo " aaflogin -f = Redo Local Login"
12 echo " aaflogout = Logout from Environment"
13 echo " aaflogin -r = Reset Password on AAF Service"
14 echo " aaflogin -h = Help"
15 echo " aafcli = AAF Management Tool"
19 if [ "$1" != "-h" ]; then
23 # Load User/Password for aafcli, and create in function.
25 # To use, source aaflogin
30 # -r = reset password sequence
32 # see aaflogout to logout
36 # Gather Classpath - warning, DME2 doesn't work with -Djava.ext.dirs
39 for JAR in `find _ROOT_DIR_/lib -name "*.jar"` ; do
44 # Create Keyfile to use temporarily, if not exists
46 if [ ! -e $HOME/.aaf/keyfile ]; then
48 ${JAVA} -cp $AAF_CP com.att.cadi.CmdLine keygen $HOME/.aaf/keyfile
49 chmod 400 $HOME/.aaf/keyfile
53 # Obtain User ID from AAF_ID, or SUDO_USER or USER, that order
55 if [ "$AAF_ID" == "" ] || [ "$1" == "-f" ] ; then
56 if [ "$AAF_ID" == "" ] ; then
57 if [ "$SUDO_USER" != "" ] ; then
59 else if [ "$USER" != "" ] ; then
65 echo -n "Enter AAF ID [$AAF_ID]: "
67 if [ "$TEMP" != "" ] ; then
74 # Add Function to remove AAF Vars and Functions from the Shell
83 rm -f $HOME/.aaf/keyfile
90 if [ "$AAF_PASS" == "" ] || [ "$1" == "-f" ] ; then
91 # Ask for User and Password. Assuming Unix and availability of "stty"
92 if [[ "$AAF_ID" == *"@$DEFAULT_DOMAIN" ]] || [[ "$AAF_ID" != *"@"* ]] ; then
93 PASS_PROMPT="AT&T Global Login"
94 AAF_DEFAULT_DOMAIN="-Daaf_default_domain=$DEFAULT_DOMAIN"
101 read -ers -p "Enter "$PASS_PROMPT" Password for $AAF_ID: " AAF_PASS
103 AAF_PASS=enc:`$JAVA -cp $AAF_CP $AAF_DEFAULT_DOMAIN com.att.cadi.CmdLine digest "$AAF_PASS" $HOME/.aaf/keyfile`
110 # load aafcli function in the Shell
114 # for separating VM_ARGS in aafcli
117 if [ "${AAF_ID}" = "${AAF_ID/@/%}" ]; then
118 THE_ID+="@$DEFAULT_DOMAIN"
120 _JAVA_HOME_/bin/java \
122 -Daaf_url=https://DME2RESOLVE/service=com.att.authz.AuthorizationService/version=_MAJOR_VER_._MINOR_VER_/envContext=_ENV_CONTEXT_/routeOffer=_ROUTE_OFFER_ \
123 -DAFT_LATITUDE=_AFT_LATITUDE_ \
124 -DAFT_LONGITUDE=_AFT_LONGITUDE_ \
125 -DAFT_ENVIRONMENT=_AFT_ENVIRONMENT_ \
127 -Daaf_password=$AAF_PASS \
128 -Daaf_dme_timeout=60000 \
129 -Dcadi_keyfile=$HOME/.aaf/keyfile \
130 -Daaf_default_realm=$DEFAULT_DOMAIN \
131 -DDEPLOYED_VERSION=_ARTIFACT_VERSION_ \
133 com.att.cmd.AAFcli $*
139 # load cmcli function in the Shell
143 # for separating VM_ARGS in cmcli
146 if [ "${AAF_ID}" = "${AAF_ID/@/%}" ]; then
147 THE_ID+="@$DEFAULT_DOMAIN"
150 if [ "${CM_URL}" = "" ]; then
151 CM_URL=https://DME2RESOLVE/service=com.att.authz.Certman/version=_MAJOR_VER_._MINOR_VER_/envContext=_ENV_CONTEXT_/routeOffer=_ROUTE_OFFER_
154 _JAVA_HOME_/bin/java \
156 -DAFT_LATITUDE=_AFT_LATITUDE_ \
157 -DAFT_LONGITUDE=_AFT_LONGITUDE_ \
158 -DAFT_ENVIRONMENT=_AFT_ENVIRONMENT_ \
159 -Daaf_dme_timeout=60000 \
160 -Daaf_default_realm=$DEFAULT_DOMAIN \
161 -DDEPLOYED_VERSION=_ARTIFACT_VERSION_ \
163 com.att.cadi.cm.CmAgent cm_url=${CM_URL} aaf_id=$THE_ID aaf_password="$AAF_PASS" \
164 cadi_keyfile=$HOME/.aaf/keyfile $*
172 # if "-r" the do Remote Password Reset
174 if [ "$1" == "-r" ] ; then
175 # Ask for User and Password. Assuming Unix and availability of "stty"
176 read -ers -p "Enter New AAF Password for $AAF_ID: " AAF_NEWPASS
178 read -ers -p "Reenter New AAF Password for $AAF_ID: " AAF_NEWPASS2
180 if [ "$AAF_NEWPASS" == "$AAF_NEWPASS2" ] ; then
181 RESP=`aafcli user resetCred "$AAF_ID@aaf.att.com" $AAF_NEWPASS`
183 if [ "$RESP" == "Reset Credential [$AAF_ID@aaf.att.com]" ] ; then
184 export AAF_PASS=enc:`$JAVA -cp $AAF_CP com.att.cadi.CmdLine digest $AAF_NEWPASS $HOME/.aaf/keyfile`
187 echo "Passwords don't match!"
192 # Export key variables for use in other Scripts