Skip to content

Commit

Permalink
Mmt 3407: Quick PR to add some debug statements for was lambda callba…
Browse files Browse the repository at this point in the history
…ck (#1123)


---------

Co-authored-by: Christopher D. Gokey <[email protected]>
Co-authored-by: Trevor Lang <[email protected]>
  • Loading branch information
3 people authored Feb 8, 2024
1 parent 4405ce5 commit daeffd9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion serverless/src/samlCallback/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,34 @@ const getLaunchpadToken = (cookieString) => {
*/
const samlCallback = async (event) => {
const { body, headers } = event
console.log('🚀 ~ samlCallback ~ headers:', headers)
console.log('🚀 ~ samlCallback ~ body:', body)

const { Cookie } = headers
console.log('🚀 ~ samlCallback ~ Cookie:', Cookie)

const { mmtHost } = getApplicationConfig()
console.log('🚀 ~ samlCallback ~ mmtHost:', mmtHost)

const params = new URLSearchParams(body)
console.log('🚀 ~ samlCallback ~ params:', params)

const launchpadToken = getLaunchpadToken(Cookie)
console.log('🚀 ~ samlCallback ~ launchpadToken:', launchpadToken)

const samlResponse = parseSaml(params.get('SAMLResponse'))
console.log('🚀 ~ samlCallback ~ samlResponse:', samlResponse)
const path = params.get('RelayState')
console.log('🚀 ~ samlCallback ~ path:', path)

const { auid, email } = samlResponse
console.log('🚀 ~ samlCallback ~ email:', email)
console.log('🚀 ~ samlCallback ~ auid:', auid)

const location = `${mmtHost}/auth_callback?target=${path}`

return {
console.log('🚀 ~ samlCallback ~ location:', location)
const response = {
statusCode: 303,
headers: {
'Set-Cookie': [
Expand All @@ -51,6 +64,9 @@ const samlCallback = async (event) => {
Location: location
}
}
console.log('🚀 ~ samlCallback ~ response:', response)

return response
}

export default samlCallback

0 comments on commit daeffd9

Please sign in to comment.