Skip to content

Instantly share code, notes, and snippets.

@akkornel
akkornel / file.py
Created May 28, 2021 06:51
Given a GCSv5 (Globus Connect Server version 5) endpoint UUID, look up the IP addresses of its DTNs.
#!/bin/env python3
# -*- coding: utf-8 -*-
# vim: ts=4 sw=4 et
# Given a GCSv5 endpoint UUID, look up the IP addresses of its DTNs.
# WARNING: Although this is more than bare-bones code, in that it
# does have a fair amount of error checking, you should not consider
# it production-ready. In particular because it relies GCSv5
# endpoint APIs that aren't documented.
# © 2021 A. Karl Kornel
@akkornel
akkornel / id_token_demo.py
Created July 13, 2021 04:11
A Python 3.6+ script showing how to get an OpenID Connect Token from Google Auth, and comparing the one you get with your own OAuth2 client ID against the one you get with the Google Cloud SDK OAuth2 client ID
#!/usr/bin/env python3
# vim: ts=4 sw=4 et
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
# This was written by A. Karl Kornel <akkornel@stanford.edu>
# It is © The Board of Trustees of the Leleand Stanford Junior University
# It is made available under the MIT License
# https://opensource.org/licenses/MIT
@akkornel
akkornel / hello.py
Created July 21, 2021 23:34
This is a Cloud Function which tells the user about the OpenID Connect ID token they used to authenticate.
import json
import jwcrypto.jwk
import jwcrypto.jwt
import jwcrypto.common
import re
import requests
# Get the OpenID Connect configuration
oauth_config_url = 'https://accounts.google.com/.well-known/openid-configuration'
oidc_config = requests.get(oauth_config_url).json()