Skip to content

Commit

Permalink
Merge pull request #8805 from Accelerynt-Security/08-16-2023--AS-Sign…
Browse files Browse the repository at this point in the history
…-Out-Google-User

08 16 2023  as sign out google user
  • Loading branch information
v-atulyadav authored Aug 29, 2023
2 parents 99d3cb6 + 6c62458 commit cef858b
Show file tree
Hide file tree
Showing 44 changed files with 786 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Playbooks/AS-Sign-Out-Google-User/CreateGoogleJWT/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import logging
import azure.functions as func
import time
from jwt import encode


def create_google_jwt(iss: str, scope: str, aud: str, private_key_id: str, private_key: str) -> str:
iat = time.time()
exp = iat + 3600
payload = {'iss': iss,
'scope': scope,
'aud': aud,
'iat': iat,
'exp': exp}
additional_headers = {'kid': private_key_id}
signed_jwt = encode(payload, private_key, headers=additional_headers, algorithm='RS256')
return signed_jwt


def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')

try:
req_body = req.get_json()
except ValueError:
return func.HttpResponse(
"Please pass 'iss', 'scope', 'aud', 'private_key_id', and 'private_key' in the request body.",
status_code=400
)

iss = req_body.get('iss')
scope = req_body.get('scope')
aud = req_body.get('aud')
private_key_id = req_body.get('private_key_id')
private_key = req_body.get('private_key')

if all([iss, scope, aud, private_key_id, private_key]):
jwt = create_google_jwt(iss, scope, aud, private_key_id, private_key)
return func.HttpResponse(jwt)
else:
return func.HttpResponse(
"Please ensure all parameters ('iss', 'scope', 'aud', 'private_key_id', and 'private_key') are in the request body.",
status_code=400
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
299 changes: 299 additions & 0 deletions Playbooks/AS-Sign-Out-Google-User/README.md

Large diffs are not rendered by default.

443 changes: 443 additions & 0 deletions Playbooks/AS-Sign-Out-Google-User/azuredeploy.json

Large diffs are not rendered by default.

0 comments on commit cef858b

Please sign in to comment.