Skip to content

Instantly share code, notes, and snippets.

View NickolausDS's full-sized avatar

Nickolaus D. Saint NickolausDS

View GitHub Profile
@NickolausDS
NickolausDS / client_server_auth.py
Created March 24, 2022 15:51
A demonstration of a client requesting a token, and the resource server consuming it
"""
The following shows how the scope created in the earlier example can be used between a
client and a server. First the client needs to login with the custom scope defined earlier.
Globus Auth then issues the client an access token which can only be used with the service
that owns the scope.
When a client sends a request to the service, the server does two things:
1. introspects the token to ensure the request is valid (in scope, user has permission, etc)
2. Uses the Dependent Token Grant to get user access tokens.
The access tokens procured in step 2 can be used for actions on behalf of the user.
@NickolausDS
NickolausDS / add_client_scope.sh
Created March 24, 2022 15:47
Making a Globus App a Resource Server
# This is a script to create a new Globus Scope for an existing Globus
# App. This script only needs to be run once, after that the scope will
# exist for the lifetime of the app or until it is deleted.
#
# You can create a new Globus App at https://developers.globus.org/
# Detailed documentation about the API class below can be found here:
# https://docs.globus.org/api/auth/reference/#clients_and_scopes_api
# You need to set the following before running this script!
# export CLIENT_ID=<client_id>
@NickolausDS
NickolausDS / tar_and_transfer.py
Last active June 22, 2021 20:33
A simple Tar and Transfer flow written in Gladier
"""
Requires Gladier and Gladier Tools.
pip install gladier gladier-tools
"""
from gladier import GladierBaseClient, generate_flow_definition
from pprint import pprint
@generate_flow_definition
class TarAndTransfer(GladierBaseClient):