Skip to content

pi-lar/JWTConnect-Python-OidcService

This branch is 1 commit behind IdentityPython/JWTConnect-Python-OidcService:develop.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d653413 · Mar 12, 2021
Mar 12, 2021
May 20, 2019
Jun 9, 2020
Mar 12, 2021
Mar 12, 2021
Jul 27, 2020
Jul 27, 2020
Oct 20, 2017
Jul 27, 2020
Jun 26, 2018
Jun 13, 2018
Dec 19, 2020
Jul 23, 2020
Oct 20, 2017
Mar 12, 2021
Dec 19, 2020

Repository files navigation

oidcservice

Implementation of OIDC/OAuth2 services

Oidcservice is the 3rd layer in the JWTConnect stack (cryptojwt, oidcmsg, oidcservice, oidcrp)

An OIDC OP or an OAuth2 AS provides a set of services to be used by an RP/client.

This package contains the necessary pieces to allow an RP/client to use those services.

Each Service instance has 3 major methods:

  • get_request_parameters
  • parse_response
  • update_service_context

get_request_parameters

This method will return a dictionary with the information you need to do a HTTP request with your favorite HTTP client library.

For instance if you use the provider info dicovery Server subclass it could look something like this:

import requests

from oidcservice.service_context import ServiceContext
from oidcservice.oidc.service import ProviderInfoDiscovery

class DB(object):
    def __init__(self):
        self.db = {}

    def set(self, key, value):
        self.db[key] = value

    def get(self, item):
        try:
            return self.db[item]
        except KeyError:
            return None

service_context = ServiceContext
service_context.issuer = "https://accounts.google.com"
service_context.keyjar = None

service = ProviderInfoDiscovery(service_context, DB())

args = service.get_request_parameters(service_context)

# Do the HTTP request
http_resp = requests.request(**args)

# giassuming that we got a 200 response
oidc_response = service.parse_response(http_resp.text, service_context)

print(oidc_response.to_dict())

The output should then be a dictionary with the provider information for Google's OP.

About

Implementation of OIDC/Oauth2 services

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.6%
  • Makefile 0.4%