Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jun 12, 2021. It is now read-only.

IdentityPython/JWTConnect-Python-OidcService

Open more actions menu

Repository files navigation

Archived !!

The functionality in this package has been included in the IdentityPython/JWTConnect-Python-OidcRP package. This package is therefor redundant and has been archived.

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

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.