Skip to content

Instantly share code, notes, and snippets.

@fire
Last active August 29, 2015 14:05
Show Gist options
  • Save fire/55c16bb6e93b35e08936 to your computer and use it in GitHub Desktop.
Save fire/55c16bb6e93b35e08936 to your computer and use it in GitHub Desktop.
REST login system UE4
#https://wiki.jasig.org/display/casum/restful+api
# This file is used to store the Ticket Getting Ticket
rm tgt.txt
# This file is used to store the Service Ticket
rm serviceTicket.txt
#This file is used to store the service call response
rm response.txt
export CAS_LOGIN_URL=http://localhost:8080/cas/v1/tickets
export GET_URL=http://localhost:8080/service
export USERNAME=username
export PASSWORD=password
Request a new Ticket Getting Ticket (TGT). This returns HTML which is put into tgt.txt.
wget --no-check-certificate -O tgt.txt --post-data="username=$USERNAME&password=$PASSWORD" $CAS_LOGIN_URL
# Extract from the HTML the TGT and put back into tgt.txt
echo TGT`grep -oEi 'action=\".*\"' tgt.txt | grep -oEi '\-.*\-cas'` > tgt.txt
# display the TGT
cat tgt.txt
# Request a new Service Ticket and store in serviceTicket.txt
wget --no-check-certificate --post-data="service=$GET_URL" -O serviceTicket.txt $CAS_LOGIN_URL/`cat tgt.txt`
# Get the data at from the service at GET_URL and store in response.txt
wget --no-check-certificate -O response.txt $GET_URL?ticket=`cat serviceTicket.txt`
# Display the data from the service call
cat response.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment