daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Apr 17th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! python3
  2.  
  3. from urllib.parse import quote_plus
  4.  
  5.  
  6. def create_aws_relay_state(idp, target):
  7.     '''
  8.     Provided an identity provider url as a string and a target url as string,
  9.     we will create an ADFS relay state. I don't know why we need to run the
  10.     quote_plus funciton twice, other than we need to re-encode all of the %
  11.     symbols a second time.
  12.     '''
  13.     rpi = quote_plus(quote_plus('urn:amazon:webservices'))
  14.     encoded_target = quote_plus(quote_plus(target))
  15.  
  16.     relay_state = idp + '?RelayState=RPID%3D' + rpi + '%26RelayState%3D' + encoded_target
  17.  
  18.     return relay_state
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top