Skip to content

Instantly share code, notes, and snippets.

@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()
@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 / 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 / output.txt
Created November 2, 2018 08:39
Errors and warnings when trying to build py-libzfs on Linux
$ make clean ; PYTHON=`which python` CFLAGS='-I/usr/include/libzfs -I/usr/src/zfs-0.7.11/include -I/usr/include/libspl' make
rm -rf build libzfs.c
/usr/bin/python setup.py build
WARNING: '' not a valid package name; please use only .-separated package names in setup.py
running build
running build_py
running build_ext
cythoning libzfs.pyx to libzfs.c
/home/akkornel/.local/lib/python2.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: ./pxd/libzfs.pxd
tree = Parsing.p_module(s, pxd, full_module_name)
@akkornel
akkornel / globus_sub_api.txt
Created October 10, 2018 20:18
Globus Subscription API suggestion
This is a request for a completely new Globus API. API credentials come from Globus Auth, but a new scope is used.
The idea behind this API is two-fold:
1. Allow the subscription to take place without having to pass credentials around.
2. Give Subscription Managers an easy way to list all the endpoints covered under a subscription, and see their details.
The last point is important: This API would give subscription managers access to endpoint details, even if the endpoint is marked private.
@akkornel
akkornel / globus-connect-server.conf
Last active May 12, 2018 21:31
Globus Connect Server configuration (Stanford-specific), part 2 for MyProxy OAuth authentication
; vim: filetype=dosini : nospell :
;------------------------------
; Globus Configuration, Part 2
; MyProxy OAuth Authentication
;------------------------------
; This is the part of /etc/globus-connect-server.conf that is specific to the
; MyProxy OAuth authentication method. You should add this content to the
; end of the file, after you have filled in the content for Part 1.
@akkornel
akkornel / globus-connect-server.conf
Created April 6, 2018 06:33
Globus Connect Server configuration (Stanford-specific), part 2 for CILogon authentication
; vim: filetype=dosini : nospell :
;------------------------------
; Globus Configuration, Part 2
; CILogon Authentication
;------------------------------
; This is the part of /etc/globus-connect-server.conf that is specific to the
; CILogon authentication method. You should add this content to the end of
; the file, after you have filled in the content for Part 1.
@akkornel
akkornel / globus-connect-server.conf
Created April 6, 2018 05:08
Globus Connect Server configuration (Stanford-specific), part 2 for legacy MyProxy authentication
; vim: filetype=dosini : nospell :
;------------------------------
; Globus Configuration, Part 2
; Legacy MyProxy Authentication
;------------------------------
; This is the part of /etc/globus-connect-server.conf that is specific to the
; legacy MyProxy authentication method. You should add this content to the
; end of the file, after you have filled in the content for Part 1.
@akkornel
akkornel / globus-endpoint_cert-demo.py
Created March 23, 2018 05:27
Show the Globus endpoint_cert API used to fetch an endpoint key & cert
# vim: ts=2 sw=2 et
# To use this, first, install the `globus-sdk` package via pip.
# Next, go to https://developers.globus.org
# Choose "Register your app with Globus".
# Make a new project, with whatever name & email you want.
# Then, go to the "Add…" menu, and choose "Add a new app".
# Choose whatever app name you want.
# For _Redirect URLs_, enter `http://localhost:4000`.
# For _Scopes_, choose `urn:globus:auth:scope:transfer.api.globus.org:all`.
@akkornel
akkornel / globus-connect-server.conf
Created March 18, 2018 19:39
Globus Connect Server configuration (Stanford-specific), part 1
; vim: filetype=dosini : nospell :
;------------------------------
; Globus Configuration, Part 1
;------------------------------
; This is the part of /etc/globus-connect-server.conf that is common to all
; authentication methods. You can fill it out even if you haven't decided on
; an authentication method to use.