<s> import json <EOL> import sys <EOL> import os <EOL> import traceback <EOL> from six . moves . urllib . parse import parse_qs <EOL> from jwkest import as_unicode <EOL> from oic . utils import shelve_wrapper <EOL> from oic . utils . authn . javascript_login import JavascriptFormMako <EOL> from oic . utils . authn . client import verify_client <EOL> from oic . utils . authn . multi_auth import setup_multi_auth <EOL> from oic . utils . authn . multi_auth import AuthnIndexedEndpointWrapper <EOL> from oic . utils . authn . saml import SAMLAuthnMethod <EOL> from oic . utils . authn . user import UsernamePasswordMako <EOL> from oic . utils . authz import AuthzHandling <EOL> from oic . utils . keyio import keyjar_init <EOL> from oic . utils . userinfo import UserInfo <EOL> from oic . utils . userinfo . aa_info import AaUserInfo <EOL> from oic . utils . webfinger import WebFinger <EOL> from oic . utils . webfinger import OIC_ISSUER <EOL> from oic . utils . authn . authn_context import AuthnBroker <EOL> from oic . utils . authn . authn_context import make_auth_verify <EOL> __author__ = '<STR_LIT>' <EOL> import re <EOL> from oic . oic . provider import Provider <EOL> from oic . oic . provider import EndSessionEndpoint <EOL> from oic . utils . http_util import * <EOL> from mako . lookup import TemplateLookup <EOL> LOGGER = logging . getLogger ( "<STR_LIT>" ) <EOL> LOGFILE_NAME = '<STR_LIT>' <EOL> hdlr = logging . FileHandler ( LOGFILE_NAME ) <EOL> base_formatter = logging . Formatter ( <EOL> "<STR_LIT>" ) <EOL> CPC = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> cpc_formatter = logging . Formatter ( CPC ) <EOL> hdlr . setFormatter ( base_formatter ) <EOL> LOGGER . addHandler ( hdlr ) <EOL> LOGGER . setLevel ( logging . DEBUG ) <EOL> URLMAP = { } <EOL> NAME = "<STR_LIT>" <EOL> OAS = None <EOL> PASSWD = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> JWKS_FILE_NAME = "<STR_LIT>" <EOL> def safe ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> _srv = _oas . server <EOL> _log_info = _oas . logger . info <EOL> _log_info ( "<STR_LIT>" ) <EOL> try : <EOL> authz = environ [ "<STR_LIT>" ] <EOL> ( typ , code ) = authz . split ( "<STR_LIT:U+0020>" ) <EOL> assert typ == "<STR_LIT>" <EOL> except KeyError : <EOL> resp = BadRequest ( "<STR_LIT>" ) <EOL> return resp ( environ , start_response ) <EOL> try : <EOL> _sinfo = _srv . sdb [ code ] <EOL> except KeyError : <EOL> resp = Unauthorized ( "<STR_LIT>" ) <EOL> return resp ( environ , start_response ) <EOL> info = "<STR_LIT>" % _sinfo [ "<STR_LIT>" ] <EOL> resp = Response ( info ) <EOL> return resp ( environ , start_response ) <EOL> def css ( environ , start_response , logger ) : <EOL> try : <EOL> info = open ( environ [ "<STR_LIT>" ] ) . read ( ) <EOL> resp = Response ( info ) <EOL> except ( OSError , IOError ) : <EOL> resp = NotFound ( environ [ "<STR_LIT>" ] ) <EOL> return resp ( environ , start_response ) <EOL> def token ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> return wsgi_wrapper ( environ , start_response , _oas . token_endpoint , <EOL> logger = logger ) <EOL> def authorization ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> return wsgi_wrapper ( environ , start_response , _oas . authorization_endpoint , <EOL> logger = logger ) <EOL> def userinfo ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> return wsgi_wrapper ( environ , start_response , _oas . userinfo_endpoint , <EOL> logger = logger ) <EOL> def op_info ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> LOGGER . info ( "<STR_LIT>" ) <EOL> return wsgi_wrapper ( environ , start_response , _oas . providerinfo_endpoint , <EOL> logger = logger ) <EOL> def registration ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> if environ [ "<STR_LIT>" ] == "<STR_LIT:POST>" : <EOL> return wsgi_wrapper ( environ , start_response , _oas . registration_endpoint , <EOL> logger = logger ) <EOL> elif environ [ "<STR_LIT>" ] == "<STR_LIT:GET>" : <EOL> return wsgi_wrapper ( environ , start_response , _oas . read_registration , <EOL> logger = logger ) <EOL> else : <EOL> resp = ServiceError ( "<STR_LIT>" ) <EOL> return resp ( environ , start_response ) <EOL> def check_id ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> return wsgi_wrapper ( environ , start_response , _oas . check_id_endpoint , <EOL> logger = logger ) <EOL> def swd_info ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> return wsgi_wrapper ( environ , start_response , _oas . discovery_endpoint , <EOL> logger = logger ) <EOL> def trace_log ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> return wsgi_wrapper ( environ , start_response , _oas . tracelog_endpoint , <EOL> logger = logger ) <EOL> def endsession ( environ , start_response , logger ) : <EOL> _oas = environ [ "<STR_LIT>" ] <EOL> return wsgi_wrapper ( environ , start_response , _oas . endsession_endpoint , <EOL> logger = logger ) <EOL> def meta_info ( environ , start_response , logger ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def webfinger ( environ , start_response , _ ) : <EOL> query = parse_qs ( environ [ "<STR_LIT>" ] ) <EOL> try : <EOL> assert query [ "<STR_LIT>" ] == [ OIC_ISSUER ] <EOL> resource = query [ "<STR_LIT>" ] [ <NUM_LIT:0> ] <EOL> except KeyError : <EOL> resp = BadRequest ( "<STR_LIT>" ) <EOL> else : <EOL> wf = WebFinger ( ) <EOL> resp = Response ( wf . response ( subject = resource , base = OAS . baseurl ) ) <EOL> return resp ( environ , start_response ) <EOL> def static_file ( path ) : <EOL> try : <EOL> os . stat ( path ) <EOL> return True <EOL> except OSError : <EOL> return False <EOL> def static ( environ , start_response , path ) : <EOL> logger . info ( "<STR_LIT>" % ( path , ) ) <EOL> try : <EOL> text = open ( path ) . read ( ) <EOL> if path . endswith ( "<STR_LIT>" ) : <EOL> start_response ( '<STR_LIT>' , [ ( '<STR_LIT:Content-Type>' , "<STR_LIT>" ) ] ) <EOL> elif path . endswith ( "<STR_LIT>" ) : <EOL> start_response ( '<STR_LIT>' , [ ( '<STR_LIT:Content-Type>' , '<STR_LIT>' ) ] ) <EOL> elif path . endswith ( "<STR_LIT>" ) : <EOL> start_response ( '<STR_LIT>' , [ ( '<STR_LIT:Content-Type>' , '<STR_LIT:application/json>' ) ] ) <EOL> elif path . endswith ( "<STR_LIT>" ) : <EOL> start_response ( '<STR_LIT>' , [ ( '<STR_LIT:Content-Type>' , '<STR_LIT>' ) ] ) <EOL> elif path . endswith ( "<STR_LIT>" ) : <EOL> start_response ( '<STR_LIT>' , [ ( '<STR_LIT:Content-Type>' , '<STR_LIT>' ) ] ) <EOL> else : <EOL> start_response ( '<STR_LIT>' , [ ( '<STR_LIT:Content-Type>' , "<STR_LIT>" ) ] ) <EOL> return [ text ] <EOL> except IOError : <EOL> resp = NotFound ( ) <EOL> return resp ( environ , start_response ) <EOL> def check_session_iframe ( environ , start_response , logger ) : <EOL> return static ( environ , start_response , "<STR_LIT>" ) <EOL> def key_rollover ( environ , start_response , _ ) : <EOL> _txt = get_post ( environ ) <EOL> _jwks = json . loads ( _txt ) <EOL> logger . info ( "<STR_LIT>" ) <EOL> OAS . do_key_rollover ( _jwks , "<STR_LIT>" % int ( time . time ( ) ) ) <EOL> f = open ( JWKS_FILE_NAME , "<STR_LIT:w>" ) <EOL> f . write ( json . dumps ( OAS . keyjar . export_jwks ( ) ) ) <EOL> f . close ( ) <EOL> resp = Response ( "<STR_LIT:OK>" ) <EOL> return resp ( environ , start_response ) <EOL> def clear_keys ( environ , start_response , _ ) : <EOL> OAS . remove_inactive_keys ( ) <EOL> resp = Response ( "<STR_LIT:OK>" ) <EOL> return resp ( environ , start_response ) <EOL> from oic . oic . provider import AuthorizationEndpoint <EOL> from oic . oic . provider import TokenEndpoint <EOL> from oic . oic . provider import UserinfoEndpoint <EOL> from oic . oic . provider import RegistrationEndpoint <EOL> ENDPOINTS = [ <EOL> AuthorizationEndpoint ( authorization ) , <EOL> TokenEndpoint ( token ) , <EOL> UserinfoEndpoint ( userinfo ) , <EOL> RegistrationEndpoint ( registration ) , <EOL> EndSessionEndpoint ( endsession ) , <EOL> ] <EOL> URLS = [ <EOL> ( r'<STR_LIT>' , op_info ) , <EOL> ( r'<STR_LIT>' , swd_info ) , <EOL> ( r'<STR_LIT>' , meta_info ) , <EOL> ( r'<STR_LIT>' , webfinger ) , <EOL> ( r'<STR_LIT>' , css ) , <EOL> ( r'<STR_LIT>' , safe ) , <EOL> ( r'<STR_LIT>' , key_rollover ) , <EOL> ( r'<STR_LIT>' , clear_keys ) , <EOL> ( r'<STR_LIT>' , check_session_iframe ) <EOL> ] <EOL> def add_endpoints ( extra ) : <EOL> global URLS <EOL> for endp in extra : <EOL> URLS . append ( ( "<STR_LIT>" % endp . etype , endp . func ) ) <EOL> ROOT = '<STR_LIT>' <EOL> LOOKUP = TemplateLookup ( directories = [ ROOT + '<STR_LIT>' , ROOT + '<STR_LIT>' ] , <EOL> module_directory = ROOT + '<STR_LIT>' , <EOL> input_encoding = '<STR_LIT:utf-8>' , output_encoding = '<STR_LIT:utf-8>' ) <EOL> def application ( environ , start_response ) : <EOL> """<STR_LIT>""" <EOL> global OAS <EOL> path = environ . get ( '<STR_LIT>' , '<STR_LIT>' ) . lstrip ( '<STR_LIT:/>' ) <EOL> logger = logging . getLogger ( '<STR_LIT>' ) <EOL> if path == "<STR_LIT>" : <EOL> return static ( environ , start_response , "<STR_LIT>" ) <EOL> environ [ "<STR_LIT>" ] = OAS <EOL> if path . startswith ( "<STR_LIT>" ) : <EOL> return static ( environ , start_response , path ) <EOL> for regex , callback in URLS : <EOL> match = re . search ( regex , path ) <EOL> if match is not None : <EOL> try : <EOL> environ [ '<STR_LIT>' ] = match . groups ( ) [ <NUM_LIT:0> ] <EOL> except IndexError : <EOL> environ [ '<STR_LIT>' ] = path <EOL> logger . info ( "<STR_LIT>" % callback ) <EOL> try : <EOL> return callback ( environ , start_response , logger ) <EOL> except Exception as err : <EOL> print ( "<STR_LIT:%s>" % err ) <EOL> message = traceback . format_exception ( * sys . exc_info ( ) ) <EOL> print ( message ) <EOL> logger . exception ( "<STR_LIT:%s>" % err ) <EOL> resp = ServiceError ( "<STR_LIT:%s>" % err ) <EOL> return resp ( environ , start_response ) <EOL> LOGGER . debug ( "<STR_LIT>" % path ) <EOL> resp = NotFound ( "<STR_LIT>" ) <EOL> return resp ( environ , start_response ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import argparse <EOL> import importlib <EOL> from cherrypy import wsgiserver <EOL> from cherrypy . wsgiserver . ssl_builtin import BuiltinSSLAdapter <EOL> from oic . utils . sdb import SessionDB <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , action = '<STR_LIT:store_true>' ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , action = '<STR_LIT:store_true>' ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT:port>' , default = <NUM_LIT> , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , action = '<STR_LIT:store_true>' ) <EOL> parser . add_argument ( <EOL> '<STR_LIT:-c>' , dest = '<STR_LIT>' , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , help = "<STR_LIT>" ) <EOL> parser . add_argument ( dest = "<STR_LIT>" ) <EOL> args = parser . parse_args ( ) <EOL> cdb = shelve_wrapper . open ( "<STR_LIT>" ) <EOL> sys . path . insert ( <NUM_LIT:0> , "<STR_LIT:.>" ) <EOL> config = importlib . import_module ( args . config ) <EOL> if args . baseurl : <EOL> config . baseurl = args . baseurl <EOL> config . issuer = config . issuer . format ( base = config . baseurl , port = args . port ) <EOL> config . SERVICE_URL = config . SERVICE_URL . format ( issuer = config . issuer ) <EOL> ac = AuthnBroker ( ) <EOL> saml_authn = None <EOL> end_points = config . AUTHENTICATION [ "<STR_LIT>" ] [ "<STR_LIT>" ] <EOL> full_end_point_paths = [ "<STR_LIT>" % ( config . issuer , ep ) for ep in end_points ] <EOL> username_password_authn = UsernamePasswordMako ( <EOL> None , "<STR_LIT>" , LOOKUP , PASSWD , "<STR_LIT>" % config . issuer , <EOL> None , full_end_point_paths ) <EOL> for authkey , value in config . AUTHENTICATION . items ( ) : <EOL> authn = None <EOL> if "<STR_LIT>" == authkey : <EOL> PASSWORD_END_POINT_INDEX = <NUM_LIT:0> <EOL> end_point = config . AUTHENTICATION [ authkey ] [ "<STR_LIT>" ] [ <EOL> PASSWORD_END_POINT_INDEX ] <EOL> authn = AuthnIndexedEndpointWrapper ( username_password_authn , <EOL> PASSWORD_END_POINT_INDEX ) <EOL> URLS . append ( ( r'<STR_LIT>' + end_point , make_auth_verify ( authn . verify ) ) ) <EOL> try : <EOL> javascript_login_authn <EOL> except NameError : <EOL> javascript_login_authn = None <EOL> if "<STR_LIT>" == authkey : <EOL> if not javascript_login_authn : <EOL> end_points = config . AUTHENTICATION [ <EOL> "<STR_LIT>" ] [ "<STR_LIT>" ] <EOL> full_end_point_paths = [ <EOL> "<STR_LIT>" % ( config . issuer , ep ) for ep in end_points ] <EOL> javascript_login_authn = JavascriptFormMako ( <EOL> None , "<STR_LIT>" , LOOKUP , PASSWD , <EOL> "<STR_LIT>" % config . issuer , None , <EOL> full_end_point_paths ) <EOL> ac . add ( "<STR_LIT>" , javascript_login_authn , "<STR_LIT>" , "<STR_LIT>" ) <EOL> JAVASCRIPT_END_POINT_INDEX = <NUM_LIT:0> <EOL> end_point = config . AUTHENTICATION [ authkey ] [ "<STR_LIT>" ] [ <EOL> JAVASCRIPT_END_POINT_INDEX ] <EOL> authn = AuthnIndexedEndpointWrapper ( javascript_login_authn , <EOL> JAVASCRIPT_END_POINT_INDEX ) <EOL> URLS . append ( ( r'<STR_LIT>' + end_point , make_auth_verify ( authn . verify ) ) ) <EOL> if "<STR_LIT>" == authkey : <EOL> from saml2 import BINDING_HTTP_REDIRECT , BINDING_HTTP_POST <EOL> if not saml_authn : <EOL> saml_authn = SAMLAuthnMethod ( <EOL> None , LOOKUP , config . SAML , config . SP_CONFIG , config . issuer , <EOL> "<STR_LIT>" % config . issuer , <EOL> userinfo = config . USERINFO ) <EOL> ac . add ( "<STR_LIT>" , saml_authn , "<STR_LIT>" , "<STR_LIT>" ) <EOL> SAML_END_POINT_INDEX = <NUM_LIT:0> <EOL> end_point = config . AUTHENTICATION [ authkey ] [ "<STR_LIT>" ] [ <EOL> SAML_END_POINT_INDEX ] <EOL> end_point_indexes = { BINDING_HTTP_REDIRECT : <NUM_LIT:0> , BINDING_HTTP_POST : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT:0> } <EOL> authn = AuthnIndexedEndpointWrapper ( saml_authn , end_point_indexes ) <EOL> URLS . append ( ( r'<STR_LIT>' + end_point , make_auth_verify ( authn . verify ) ) ) <EOL> if "<STR_LIT>" == authkey : <EOL> from saml2 import BINDING_HTTP_REDIRECT , BINDING_HTTP_POST <EOL> if not saml_authn : <EOL> saml_authn = SAMLAuthnMethod ( <EOL> None , LOOKUP , config . SAML , config . SP_CONFIG , config . issuer , <EOL> "<STR_LIT>" % config . issuer , <EOL> userinfo = config . USERINFO ) <EOL> PASSWORD_END_POINT_INDEX = <NUM_LIT:1> <EOL> SAML_END_POINT_INDEX = <NUM_LIT:1> <EOL> password_end_point = config . AUTHENTICATION [ "<STR_LIT>" ] [ <EOL> "<STR_LIT>" ] [ PASSWORD_END_POINT_INDEX ] <EOL> saml_endpoint = config . AUTHENTICATION [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ <EOL> SAML_END_POINT_INDEX ] <EOL> end_point_indexes = { BINDING_HTTP_REDIRECT : <NUM_LIT:1> , BINDING_HTTP_POST : <NUM_LIT:1> , <EOL> "<STR_LIT>" : <NUM_LIT:1> } <EOL> multi_saml = AuthnIndexedEndpointWrapper ( saml_authn , <EOL> end_point_indexes ) <EOL> multi_password = AuthnIndexedEndpointWrapper ( <EOL> username_password_authn , PASSWORD_END_POINT_INDEX ) <EOL> auth_modules = [ ( multi_saml , r'<STR_LIT>' + saml_endpoint ) , <EOL> ( multi_password , r'<STR_LIT>' + password_end_point ) ] <EOL> authn = setup_multi_auth ( ac , URLS , auth_modules ) <EOL> if "<STR_LIT>" == authkey : <EOL> if not javascript_login_authn : <EOL> end_points = config . AUTHENTICATION [ <EOL> "<STR_LIT>" ] [ "<STR_LIT>" ] <EOL> full_end_point_paths = [ <EOL> "<STR_LIT>" % ( config . issuer , ep ) for ep in end_points ] <EOL> javascript_login_authn = JavascriptFormMako ( <EOL> None , "<STR_LIT>" , LOOKUP , PASSWD , <EOL> "<STR_LIT>" % config . issuer , None , <EOL> full_end_point_paths ) <EOL> PASSWORD_END_POINT_INDEX = <NUM_LIT:2> <EOL> JAVASCRIPT_POINT_INDEX = <NUM_LIT:1> <EOL> password_end_point = config . AUTHENTICATION [ "<STR_LIT>" ] [ <EOL> "<STR_LIT>" ] [ PASSWORD_END_POINT_INDEX ] <EOL> javascript_end_point = config . AUTHENTICATION [ "<STR_LIT>" ] [ <EOL> "<STR_LIT>" ] [ JAVASCRIPT_POINT_INDEX ] <EOL> multi_password = AuthnIndexedEndpointWrapper ( <EOL> username_password_authn , PASSWORD_END_POINT_INDEX ) <EOL> multi_javascript = AuthnIndexedEndpointWrapper ( <EOL> javascript_login_authn , JAVASCRIPT_POINT_INDEX ) <EOL> auth_modules = [ ( multi_password , r'<STR_LIT>' + password_end_point ) , <EOL> ( multi_javascript , r'<STR_LIT>' + javascript_end_point ) ] <EOL> authn = setup_multi_auth ( ac , URLS , auth_modules ) <EOL> if authn is not None : <EOL> ac . add ( config . AUTHENTICATION [ authkey ] [ "<STR_LIT>" ] , authn , <EOL> config . AUTHENTICATION [ authkey ] [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" ) <EOL> authz = AuthzHandling ( ) <EOL> kwargs = { <EOL> "<STR_LIT>" : LOOKUP , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> } <EOL> if args . insecure : <EOL> kwargs [ "<STR_LIT>" ] = False <EOL> else : <EOL> kwargs [ "<STR_LIT>" ] = True <EOL> if args . capabilities : <EOL> kwargs [ "<STR_LIT>" ] = json . loads ( open ( args . capabilities ) . read ( ) ) <EOL> else : <EOL> pass <EOL> OAS = Provider ( config . issuer , SessionDB ( config . baseurl ) , cdb , ac , None , <EOL> authz , verify_client , config . SYM_KEY , ** kwargs ) <EOL> OAS . baseurl = config . issuer <EOL> for authn in ac : <EOL> authn . srv = OAS <EOL> if config . USERINFO == "<STR_LIT>" : <EOL> OAS . userinfo = UserInfo ( config . USERDB ) <EOL> elif config . USERINFO == "<STR_LIT>" : <EOL> OAS . userinfo = UserInfo ( config . SAML ) <EOL> elif config . USERINFO == "<STR_LIT>" : <EOL> OAS . userinfo = AaUserInfo ( config . SP_CONFIG , config . issuer , config . SAML ) <EOL> else : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> try : <EOL> OAS . cookie_ttl = config . COOKIETTL <EOL> except AttributeError : <EOL> pass <EOL> try : <EOL> OAS . cookie_name = config . COOKIENAME <EOL> except AttributeError : <EOL> pass <EOL> if args . debug : <EOL> OAS . debug = True <EOL> add_endpoints ( ENDPOINTS ) <EOL> OAS . endpoints = ENDPOINTS <EOL> try : <EOL> jwks = keyjar_init ( OAS , config . keys , kid_template = "<STR_LIT>" ) <EOL> except Exception as err : <EOL> LOGGER . error ( "<STR_LIT>" % err ) <EOL> OAS . key_setup ( "<STR_LIT>" , sig = { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } ) <EOL> else : <EOL> jwks_file_name = JWKS_FILE_NAME <EOL> f = open ( jwks_file_name , "<STR_LIT:w>" ) <EOL> for key in jwks [ "<STR_LIT>" ] : <EOL> for k in key . keys ( ) : <EOL> key [ k ] = as_unicode ( key [ k ] ) <EOL> f . write ( json . dumps ( jwks ) ) <EOL> f . close ( ) <EOL> OAS . jwks_uri = "<STR_LIT>" % ( OAS . baseurl , jwks_file_name ) <EOL> for b in OAS . keyjar [ "<STR_LIT>" ] : <EOL> LOGGER . info ( "<STR_LIT>" % b ) <EOL> SRV = wsgiserver . CherryPyWSGIServer ( ( '<STR_LIT>' , args . port ) , application ) <EOL> https = "<STR_LIT>" <EOL> if config . SERVICE_URL . startswith ( "<STR_LIT>" ) : <EOL> https = "<STR_LIT>" <EOL> SRV . ssl_adapter = BuiltinSSLAdapter ( config . SERVER_CERT , config . SERVER_KEY , config . CERT_CHAIN ) <EOL> LOGGER . info ( "<STR_LIT>" % ( args . port , <EOL> https ) ) <EOL> print ( "<STR_LIT>" % ( args . port , https ) ) <EOL> try : <EOL> SRV . start ( ) <EOL> except KeyboardInterrupt : <EOL> SRV . stop ( ) </s>
