Exemple #1
0
    def create_services(self):
        # OP

        fed_ent = FOODLE
        fed_ent.fo_priority = [SWAMID.iss, FEIDE.iss]
        fed_ent.federation = ''
        fed_ent.provider_federations = None
        fed_ent.registration_federations = None
        fed_ent.jwks_bundle = fo_keybundle

        client_config = {
            'client_id': 'client_id',
            'client_secret': 'password',
            'redirect_uris': ['https://example.com/cli/authz_cb'],
            'client_preferences': {
                'id_token_signed_response_alg': 'RS384',
                'userinfo_signed_response_alg': 'RS384'
            }
        }
        _context = ServiceContext(config=client_config)
        _context.federation_entity = fed_ent
        _context.issuer = SUNET_OP.iss
        self.service = build_services(
            {
                'FedProviderInfoDiscovery': {},
                'FedRegistrationRequest': {}
            }, factory, _context, DB())
        _context.service = self.service
Exemple #2
0
    def __init__(self,
                 state_db,
                 ca_certs=None,
                 client_authn_factory=None,
                 keyjar=None,
                 verify_ssl=True,
                 config=None,
                 client_cert=None,
                 httplib=None,
                 services=None,
                 service_factory=None,
                 jwks_uri='',
                 module_dirs=None):
        """

        :param ca_certs: Certificates used to verify HTTPS certificates
        :param client_authn_factory: Factory that this client can use to
            initiate a client authentication class.
        :param keyjar: A py:class:`oidcmsg.key_jar.KeyJar` instance
        :param verify_ssl: Whether the SSL certificate should be verified.
        :param config: Configuration information passed on to the
            :py:class:`oidcservice.service_context.ServiceContext` 
            initialization
        :param client_cert: Certificate used by the HTTP client
        :param httplib: A HTTP client to use
        :param services: A list of service definitions
        :param service_factory: A factory to use when building the
            :py:class:`oidcservice.service.Service` instances
        :param jwks_uri: A jwks_uri
        :return: Client instance
        """

        self.session_interface = StateInterface(state_db)
        self.http = httplib or HTTPLib(
            ca_certs=ca_certs, verify_ssl=verify_ssl, client_cert=client_cert)

        if not keyjar:
            keyjar = KeyJar()
            keyjar.verify_ssl = verify_ssl

        self.events = None
        self.service_context = ServiceContext(keyjar,
                                              config=config,
                                              jwks_uri=jwks_uri)
        if self.service_context.client_id:
            self.client_id = self.service_context.client_id

        _cam = client_authn_factory or ca_factory
        self.service_factory = service_factory or default_service_factory
        _srvs = services or DEFAULT_SERVICES

        if not module_dirs:
            module_dirs = ['oauth2']

        self.service = build_services(_srvs, self.service_factory, module_dirs,
                                      self.service_context, state_db, _cam)

        self.service_context.service = self.service

        self.verify_ssl = verify_ssl
Exemple #3
0
    def create_services(self):
        # RP

        client_config = {
            "base_url": "https://foodle.example.com",
            "issuer": SUNET_OP.iss,
            "client_id": "xxxxxxxxx",
            "client_secret": "2222222222",
            "redirect_uris": ["https://foodle.example.com/authz_cb/sunet_op"],
            "client_prefs": {
                "response_types": ["code"],
                "scope": ["openid", "profile", "email"],
                "token_endpoint_auth_method": "client_secret_basic"
            }
        }
        _context = ServiceContext(config=client_config)

        FOODLE.context = 'registration'
        FOODLE.federation = FEIDE.iss
        _context.federation_entity = FOODLE

        self.service = build_services(
            {
                'FedProviderInfoDiscovery': {},
                'FedRegistrationRequest': {}
            }, factory, _context, DB())
            "application_type":
            "web",
            "application_name":
            "rphandler",
            "contacts": ["*****@*****.**"],
            "response_types": ["code"],
            "scope": ["openid", "profile", "email", "address", "phone"],
            "token_endpoint_auth_method":
            ["client_secret_basic", 'client_secret_post'],
        },
        "redirect_uris": ["{}/authz_cb".format(RP_BASEURL)],
        "jwks_uri": "{}/static/jwks.json".format(RP_BASEURL)
    })

service = build_services(service_spec,
                         factory,
                         service_context=service_context)

service_context.service = service

# ======================== WebFinger ========================

info = service['webfinger'].get_request_parameters(
    resource='*****@*****.**')

print(info)

webfinger_response = json.dumps({
    "subject":
    "acct:[email protected]",
    "links": [{
Exemple #5
0
            "application_type":
            "web",
            "application_name":
            "rphandler",
            "contacts": ["*****@*****.**"],
            "response_types": ["code"],
            "scope": ["openid", "profile", "email", "address", "phone"],
            "token_endpoint_auth_method":
            ["client_secret_basic", 'client_secret_post'],
        },
        "redirect_uris": ["{}/authz_cb".format(RP_BASEURL)],
        "jwks_uri": "{}/static/jwks.json".format(RP_BASEURL)
    })

service = build_services(service_spec,
                         factory,
                         state_db=InMemoryStateDataBase(),
                         service_context=service_context)

service_context.service = service

# ======================== WebFinger ========================

info = service['webfinger'].get_request_parameters(
    resource='*****@*****.**')

print(info)

webfinger_response = json.dumps({
    "subject":
    "acct:[email protected]",
    "links": [{