File: globus_authorizers.rst

package info (click to toggle)
python-globus-sdk 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,172 kB
  • sloc: python: 35,227; sh: 44; makefile: 35
file content (93 lines) | stat: -rw-r--r-- 2,819 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
.. _globus_authorizers:

Globus Authorizers
==================

.. currentmodule:: globus_sdk.authorizers

Globus SDK clients need credentials (tokens) to authenticate against services
and authorize their various API calls. Using Globus Auth, the Globus OAuth2
service, clients can be provided with credentials which are either static or
dynamic.

The interface used to handle these credentials is :class:`GlobusAuthorizer`.
:class:`GlobusAuthorizer` defines methods which provide an ``Authorization``
header for HTTP requests, and different implementations handle Refresh Tokens,
Access Tokens, Client Credentials, and their various usage modes.

A :class:`GlobusAuthorizer` is an object which defines the following two
operations:

- get an ``Authorization`` header
- handle a 401 Unauthorized error

Clients contain authorizers, and use them to get and refresh their credentials.
Whenever using the :ref:`Service Clients <services>`, you should be passing in an
authorizer when you create a new client unless otherwise specified.

The type of authorizer you will use depends very much on your application, but
if you want examples you should look at the :ref:`examples section
<examples-authorization>`.
It may help to start with the examples and come back to the reference
documentation afterwards.

The Authorizer Interface
------------------------

We define the interface for ``GlobusAuthorizer`` objects in terms of an
Abstract Base Class:

.. autoclass:: GlobusAuthorizer
    :members:
    :member-order: bysource

Authorizers within this SDK fall into two categories:

 * "Static Authorizers" already contain all authorization data and simply format it
   into the proper authorization header.
   These all inherit from the ``StaticGlobusAuthorizer`` class.

 * "Renewing Authorizer" take some initial parameters but internally define a
   functional behavior to acquire new authorization data as necessary.
   These all inherit from the ``RenewingGlobusAuthorizer`` class.

.. autoclass:: StaticGlobusAuthorizer
    :member-order: bysource
    :show-inheritance:

.. autoclass:: RenewingAuthorizer
    :member-order: bysource
    :show-inheritance:

Authorizer Types
----------------

.. currentmodule:: globus_sdk

All of these types of authorizers can be imported from
``globus_sdk.authorizers``.

.. autoclass:: AccessTokenAuthorizer
    :members:
    :member-order: bysource
    :show-inheritance:

.. autoclass:: RefreshTokenAuthorizer
    :members:
    :member-order: bysource
    :show-inheritance:

.. autoclass:: ClientCredentialsAuthorizer
    :members:
    :member-order: bysource
    :show-inheritance:

.. autoclass:: BasicAuthorizer
    :members:
    :member-order: bysource
    :show-inheritance:

.. autoclass:: NullAuthorizer
    :members:
    :member-order: bysource
    :show-inheritance: