daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Apr 17th, 2018 62 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
Top