INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
:type data: dict[str, dict[str, str] | str]
:rtype: satosa.internal_data.InternalResponse
:param data: A dict representation of an InternalResponse object
:return: An InternalResponse object | def from_dict(cls, data):
"""
:type data: dict[str, dict[str, str] | str]
:rtype: satosa.internal_data.InternalResponse
:param data: A dict representation of an InternalResponse object
:return: An InternalResponse object
"""
auth_info = _AuthenticationInformation.... |
Saves all necessary information needed by the UserIdHasher
:type internal_request: satosa.internal_data.InternalRequest
:param internal_request: The request
:param state: The current state | def save_state(internal_request, state):
"""
Saves all necessary information needed by the UserIdHasher
:type internal_request: satosa.internal_data.InternalRequest
:param internal_request: The request
:param state: The current state
"""
state_data = {"hash_type... |
Hashes a value together with a salt.
:type salt: str
:type value: str
:param salt: hash salt
:param value: value to hash together with the salt
:return: hash value (SHA512) | def hash_data(salt, value):
"""
Hashes a value together with a salt.
:type salt: str
:type value: str
:param salt: hash salt
:param value: value to hash together with the salt
:return: hash value (SHA512)
"""
msg = "UserIdHasher is deprecated; use ... |
Sets a user id to the internal_response,
in the format specified by the internal response
:type salt: str
:type user_id: str
:type requester: str
:type state: satosa.state.State
:rtype: str
:param salt: A salt string for the ID hashing
:param user_id: th... | def hash_id(salt, user_id, requester, state):
"""
Sets a user id to the internal_response,
in the format specified by the internal response
:type salt: str
:type user_id: str
:type requester: str
:type state: satosa.state.State
:rtype: str
:param... |
Unpacks a post request query string.
:param environ: whiskey application environment.
:return: A dictionary with parameters. | def unpack_post(environ, content_length):
"""
Unpacks a post request query string.
:param environ: whiskey application environment.
:return: A dictionary with parameters.
"""
post_body = environ['wsgi.input'].read(content_length).decode("utf-8")
data = None
if "application/x-www-form-url... |
Unpacks a get or post request query string.
:param environ: whiskey application environment.
:return: A dictionary with parameters. | def unpack_request(environ, content_length=0):
"""
Unpacks a get or post request query string.
:param environ: whiskey application environment.
:return: A dictionary with parameters.
"""
data = None
if environ["REQUEST_METHOD"] == "GET":
data = unpack_get(environ)
elif environ["R... |
Inserts a path to the context.
This path is striped by the base_url, so for example:
A path BASE_URL/ENDPOINT_URL, would be inserted as only ENDPOINT_URL
https://localhost:8092/sso/redirect -> sso/redirect
:type p: str
:param p: A path to an endpoint.
:return: N... | def path(self, p):
"""
Inserts a path to the context.
This path is striped by the base_url, so for example:
A path BASE_URL/ENDPOINT_URL, would be inserted as only ENDPOINT_URL
https://localhost:8092/sso/redirect -> sso/redirect
:type p: str
:param p: A ... |
Load all backend modules specified in the config
:type config: satosa.satosa_config.SATOSAConfig
:type callback:
(satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response
:type internal_attributes: dict[string, dict[str, str | list[str]]]
:rtype: Sequence[satosa.backends.ba... | def load_backends(config, callback, internal_attributes):
"""
Load all backend modules specified in the config
:type config: satosa.satosa_config.SATOSAConfig
:type callback:
(satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response
:type internal_attributes: dict[strin... |
Load all frontend modules specified in the config
:type config: satosa.satosa_config.SATOSAConfig
:type callback:
(satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response
:type internal_attributes: dict[string, dict[str, str | list[str]]]
:rtype: Sequence[satosa.frontends.... | def load_frontends(config, callback, internal_attributes):
"""
Load all frontend modules specified in the config
:type config: satosa.satosa_config.SATOSAConfig
:type callback:
(satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response
:type internal_attributes: dict[str... |
Will only give a find on classes that is a subclass of MicroService, with the exception that
the class is not allowed to be a direct ResponseMicroService or RequestMicroService.
:type cls: type
:rtype: bool
:param cls: A class object
:return: True if match, else false | def _micro_service_filter(cls):
"""
Will only give a find on classes that is a subclass of MicroService, with the exception that
the class is not allowed to be a direct ResponseMicroService or RequestMicroService.
:type cls: type
:rtype: bool
:param cls: A class object
:return: True if mat... |
Loads endpoint plugins
:type plugin_paths: list[str]
:type plugins: list[str]
:type plugin_filter: (type | str) -> bool
:type internal_attributes: dict[string, dict[str, str | list[str]]]
:rtype list[satosa.plugin_base.endpoint.InterfaceModulePlugin]
:param plugin_paths: Path to the plugin dir... | def _load_plugins(plugin_paths, plugins, plugin_filter, base_url, internal_attributes, callback):
"""
Loads endpoint plugins
:type plugin_paths: list[str]
:type plugins: list[str]
:type plugin_filter: (type | str) -> bool
:type internal_attributes: dict[string, dict[str, str | list[str]]]
:... |
Loads request micro services (handling incoming requests).
:type plugin_path: list[str]
:type plugins: list[str]
:type internal_attributes: dict[string, dict[str, str | list[str]]]
:type base_url: str
:rtype satosa.micro_service.service_base.RequestMicroService
:param plugin_path: Path to the ... | def load_request_microservices(plugin_path, plugins, internal_attributes, base_url):
"""
Loads request micro services (handling incoming requests).
:type plugin_path: list[str]
:type plugins: list[str]
:type internal_attributes: dict[string, dict[str, str | list[str]]]
:type base_url: str
:... |
Loads response micro services (handling outgoing responses).
:type plugin_path: list[str]
:type plugins: list[str]
:type internal_attributes: dict[string, dict[str, str | list[str]]]
:type base_url: str
:rtype satosa.micro_service.service_base.ResponseMicroService
:param plugin_path: Path to t... | def load_response_microservices(plugin_path, plugins, internal_attributes, base_url):
"""
Loads response micro services (handling outgoing responses).
:type plugin_path: list[str]
:type plugins: list[str]
:type internal_attributes: dict[string, dict[str, str | list[str]]]
:type base_url: str
... |
Generates SAML metadata for the given PROXY_CONF, signed with the given KEY and associated CERT. | def create_and_write_saml_metadata(proxy_conf, key, cert, dir, valid, split_frontend_metadata=False,
split_backend_metadata=False):
"""
Generates SAML metadata for the given PROXY_CONF, signed with the given KEY and associated CERT.
"""
satosa_config = SATOSAConfig(pro... |
See super class satosa.frontends.base.FrontendModule
:type backend_names: list[str]
:rtype: list[(str, ((satosa.context.Context, Any) -> satosa.response.Response, Any))]
:raise ValueError: if more than one backend is configured | def register_endpoints(self, backend_names):
"""
See super class satosa.frontends.base.FrontendModule
:type backend_names: list[str]
:rtype: list[(str, ((satosa.context.Context, Any) -> satosa.response.Response, Any))]
:raise ValueError: if more than one backend is configured
... |
Create a pyoidc client instance.
:param provider_metadata: provider configuration information
:type provider_metadata: Mapping[str, Union[str, Sequence[str]]]
:param client_metadata: client metadata
:type client_metadata: Mapping[str, Union[str, Sequence[str]]]
:return: client instance to use for co... | def _create_client(provider_metadata, client_metadata, verify_ssl=True):
"""
Create a pyoidc client instance.
:param provider_metadata: provider configuration information
:type provider_metadata: Mapping[str, Union[str, Sequence[str]]]
:param client_metadata: client metadata
:type client_metadat... |
See super class method satosa.backends.base#start_auth
:type context: satosa.context.Context
:type request_info: satosa.internal.InternalData | def start_auth(self, context, request_info):
"""
See super class method satosa.backends.base#start_auth
:type context: satosa.context.Context
:type request_info: satosa.internal.InternalData
"""
oidc_nonce = rndstr()
oidc_state = rndstr()
state_data = {
... |
Creates a list of all the endpoints this backend module needs to listen to. In this case
it's the authentication response from the underlying OP that is redirected from the OP to
the proxy.
:rtype: Sequence[(str, Callable[[satosa.context.Context], satosa.response.Response]]
:return: A li... | def register_endpoints(self):
"""
Creates a list of all the endpoints this backend module needs to listen to. In this case
it's the authentication response from the underlying OP that is redirected from the OP to
the proxy.
:rtype: Sequence[(str, Callable[[satosa.context.Context]... |
Verify the received OIDC 'nonce' from the ID Token.
:param nonce: OIDC nonce
:type nonce: str
:param context: current request context
:type context: satosa.context.Context
:raise SATOSAAuthenticationError: if the nonce is incorrect | def _verify_nonce(self, nonce, context):
"""
Verify the received OIDC 'nonce' from the ID Token.
:param nonce: OIDC nonce
:type nonce: str
:param context: current request context
:type context: satosa.context.Context
:raise SATOSAAuthenticationError: if the nonce ... |
:param authn_response: authentication response from OP
:type authn_response: oic.oic.message.AuthorizationResponse
:return: access token and ID Token claims
:rtype: Tuple[Optional[str], Optional[Mapping[str, str]]] | def _get_tokens(self, authn_response, context):
"""
:param authn_response: authentication response from OP
:type authn_response: oic.oic.message.AuthorizationResponse
:return: access token and ID Token claims
:rtype: Tuple[Optional[str], Optional[Mapping[str, str]]]
"""
... |
Check if the response is an OAuth error response.
:param response: the OIDC response
:type response: oic.oic.message
:raise SATOSAAuthenticationError: if the response is an OAuth error response | def _check_error_response(self, response, context):
"""
Check if the response is an OAuth error response.
:param response: the OIDC response
:type response: oic.oic.message
:raise SATOSAAuthenticationError: if the response is an OAuth error response
"""
if "error"... |
Handles the authentication response from the OP.
:type context: satosa.context.Context
:type args: Any
:rtype: satosa.response.Response
:param context: SATOSA context
:param args: None
:return: | def response_endpoint(self, context, *args):
"""
Handles the authentication response from the OP.
:type context: satosa.context.Context
:type args: Any
:rtype: satosa.response.Response
:param context: SATOSA context
:param args: None
:return:
"""
... |
Translates oidc response to SATOSA internal response.
:type response: dict[str, str]
:type issuer: str
:type subject_type: str
:rtype: InternalData
:param response: Dictioary with attribute name as key.
:param issuer: The oidc op that gave the repsonse.
:param su... | def _translate_response(self, response, issuer):
"""
Translates oidc response to SATOSA internal response.
:type response: dict[str, str]
:type issuer: str
:type subject_type: str
:rtype: InternalData
:param response: Dictioary with attribute name as key.
... |
Endpoint for handling account linking service response. When getting here
user might have approved or rejected linking their account
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The current context
:return: response | def _handle_al_response(self, context):
"""
Endpoint for handling account linking service response. When getting here
user might have approved or rejected linking their account
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The cu... |
Manage account linking and recovery
:type context: satosa.context.Context
:type internal_response: satosa.internal.InternalData
:rtype: satosa.response.Response
:param context:
:param internal_response:
:return: response
: | def process(self, context, internal_response):
"""
Manage account linking and recovery
:type context: satosa.context.Context
:type internal_response: satosa.internal.InternalData
:rtype: satosa.response.Response
:param context:
:param internal_response:
... |
Ask the account linking service for a uuid.
If the given issuer/id pair is not linked, then the function will return a ticket.
This ticket should be used for linking the issuer/id pair to the user account
:type context: satosa.context.Context
:type issuer: str
:type id: str
... | def _get_uuid(self, context, issuer, id):
"""
Ask the account linking service for a uuid.
If the given issuer/id pair is not linked, then the function will return a ticket.
This ticket should be used for linking the issuer/id pair to the user account
:type context: satosa.contex... |
Returns the targeted backend and an updated state
:type context: satosa.context.Context
:rtype satosa.backends.base.BackendModule
:param context: The request context
:return: backend | def backend_routing(self, context):
"""
Returns the targeted backend and an updated state
:type context: satosa.context.Context
:rtype satosa.backends.base.BackendModule
:param context: The request context
:return: backend
"""
satosa_logging(logger, logg... |
Returns the targeted frontend and original state
:type context: satosa.context.Context
:rtype satosa.frontends.base.FrontendModule
:param context: The response context
:return: frontend | def frontend_routing(self, context):
"""
Returns the targeted frontend and original state
:type context: satosa.context.Context
:rtype satosa.frontends.base.FrontendModule
:param context: The response context
:return: frontend
"""
target_frontend = cont... |
Finds and returns the endpoint function bound to the path
:type context: satosa.context.Context
:rtype: ((satosa.context.Context, Any) -> Any, Any)
:param context: The request context
:return: registered endpoint and bound parameters | def endpoint_routing(self, context):
"""
Finds and returns the endpoint function bound to the path
:type context: satosa.context.Context
:rtype: ((satosa.context.Context, Any) -> Any, Any)
:param context: The request context
:return: registered endpoint and bound parame... |
This function is called by a frontend module when an authorization request has been
processed.
:type context: satosa.context.Context
:type internal_request: satosa.internal.InternalData
:rtype: satosa.response.Response
:param context: The request context
:param internal... | def _auth_req_callback_func(self, context, internal_request):
"""
This function is called by a frontend module when an authorization request has been
processed.
:type context: satosa.context.Context
:type internal_request: satosa.internal.InternalData
:rtype: satosa.resp... |
This function is called by a backend module when the authorization is
complete.
:type context: satosa.context.Context
:type internal_response: satosa.internal.InternalData
:rtype: satosa.response.Response
:param context: The request context
:param internal_response: The... | def _auth_resp_callback_func(self, context, internal_response):
"""
This function is called by a backend module when the authorization is
complete.
:type context: satosa.context.Context
:type internal_response: satosa.internal.InternalData
:rtype: satosa.response.Respons... |
Sends a response to the requester about the error
:type error: satosa.exception.SATOSAAuthenticationError
:rtype: satosa.response.Response
:param error: The exception
:return: response | def _handle_satosa_authentication_error(self, error):
"""
Sends a response to the requester about the error
:type error: satosa.exception.SATOSAAuthenticationError
:rtype: satosa.response.Response
:param error: The exception
:return: response
"""
context... |
Load state from cookie to the context
:type context: satosa.context.Context
:param context: Session context | def _load_state(self, context):
"""
Load state from cookie to the context
:type context: satosa.context.Context
:param context: Session context
"""
try:
state = cookie_to_state(
context.cookie,
self.config["COOKIE_STATE... |
Saves a state from context to cookie
:type resp: satosa.response.Response
:type context: satosa.context.Context
:param resp: The response
:param context: Session context | def _save_state(self, resp, context):
"""
Saves a state from context to cookie
:type resp: satosa.response.Response
:type context: satosa.context.Context
:param resp: The response
:param context: Session context
"""
cookie = state_to_cookie(context.stat... |
Runs the satosa proxy with the given context.
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The request context
:return: response | def run(self, context):
"""
Runs the satosa proxy with the given context.
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The request context
:return: response
"""
try:
self._load_state(context)
... |
Creates SAML metadata strings for the configured front- and backends.
:param satosa_config: configuration of the proxy
:return: a tuple of the frontend metadata (containing IdP entities) and the backend metadata (containing SP
entities).
:type satosa_config: satosa.satosa_config.SATOSAConfig
... | def create_entity_descriptors(satosa_config):
"""
Creates SAML metadata strings for the configured front- and backends.
:param satosa_config: configuration of the proxy
:return: a tuple of the frontend metadata (containing IdP entities) and the backend metadata (containing SP
entities).
... |
:param entity_descriptors: the entity descriptors to put in in an EntitiesDescriptor tag and sign
:param security_context: security context for the signature
:param valid_for: number of hours the metadata should be valid
:return: the signed XML document
:type entity_descriptors: Sequence[saml2.md.Entit... | def create_signed_entities_descriptor(entity_descriptors, security_context, valid_for=None):
"""
:param entity_descriptors: the entity descriptors to put in in an EntitiesDescriptor tag and sign
:param security_context: security context for the signature
:param valid_for: number of hours the metadata sh... |
:param entity_descriptor: the entity descriptor to sign
:param security_context: security context for the signature
:param valid_for: number of hours the metadata should be valid
:return: the signed XML document
:type entity_descriptor: saml2.md.EntityDescriptor]
:type security_context: saml2.sigve... | def create_signed_entity_descriptor(entity_descriptor, security_context, valid_for=None):
"""
:param entity_descriptor: the entity descriptor to sign
:param security_context: security context for the signature
:param valid_for: number of hours the metadata should be valid
:return: the signed XML doc... |
See super class method satosa.backends.base.BackendModule#start_auth
:type context: satosa.context.Context
:type internal_req: satosa.internal.InternalData
:rtype: satosa.response.Response | def start_auth(self, context, internal_req):
"""
See super class method satosa.backends.base.BackendModule#start_auth
:type context: satosa.context.Context
:type internal_req: satosa.internal.InternalData
:rtype: satosa.response.Response
"""
target_entity_id = co... |
Makes a request to the discovery server
:type context: satosa.context.Context
:type internal_req: satosa.internal.InternalData
:rtype: satosa.response.SeeOther
:param context: The current context
:param internal_req: The request
:return: Response | def disco_query(self):
"""
Makes a request to the discovery server
:type context: satosa.context.Context
:type internal_req: satosa.internal.InternalData
:rtype: satosa.response.SeeOther
:param context: The current context
:param internal_req: The request
... |
Do an authorization request on idp with given entity id.
This is the start of the authorization.
:type context: satosa.context.Context
:type entity_id: str
:rtype: satosa.response.Response
:param context: The current context
:param entity_id: Target IDP entity id
... | def authn_request(self, context, entity_id):
"""
Do an authorization request on idp with given entity id.
This is the start of the authorization.
:type context: satosa.context.Context
:type entity_id: str
:rtype: satosa.response.Response
:param context: The curr... |
Endpoint for the idp response
:type context: satosa.context,Context
:type binding: str
:rtype: satosa.response.Response
:param context: The current context
:param binding: The saml binding type
:return: response | def authn_response(self, context, binding):
"""
Endpoint for the idp response
:type context: satosa.context,Context
:type binding: str
:rtype: satosa.response.Response
:param context: The current context
:param binding: The saml binding type
:return: resp... |
Endpoint for the discovery server response
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The current context
:return: response | def disco_response(self, context):
"""
Endpoint for the discovery server response
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The current context
:return: response
"""
info = context.request
state = cont... |
Translates a saml authorization response to an internal response
:type response: saml2.response.AuthnResponse
:rtype: satosa.internal.InternalData
:param response: The saml authorization response
:return: A translated internal response | def _translate_response(self, response, state):
"""
Translates a saml authorization response to an internal response
:type response: saml2.response.AuthnResponse
:rtype: satosa.internal.InternalData
:param response: The saml authorization response
:return: A translated i... |
Endpoint for retrieving the backend metadata
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The current context
:return: response with metadata | def _metadata_endpoint(self, context):
"""
Endpoint for retrieving the backend metadata
:type context: satosa.context.Context
:rtype: satosa.response.Response
:param context: The current context
:return: response with metadata
"""
satosa_logging(logger, l... |
See super class method satosa.backends.base.BackendModule#register_endpoints
:rtype list[(str, ((satosa.context.Context, Any) -> Any, Any))] | def register_endpoints(self):
"""
See super class method satosa.backends.base.BackendModule#register_endpoints
:rtype list[(str, ((satosa.context.Context, Any) -> Any, Any))]
"""
url_map = []
sp_endpoints = self.sp.config.getattr("endpoints", "sp")
for endp, bindi... |
See super class satosa.backends.backend_base.BackendModule#get_metadata_desc
:rtype: satosa.metadata_creation.description.MetadataDescription | def get_metadata_desc(self):
"""
See super class satosa.backends.backend_base.BackendModule#get_metadata_desc
:rtype: satosa.metadata_creation.description.MetadataDescription
"""
entity_descriptions = []
idp_entities = self.sp.metadata.with_descriptor("idpsso")
f... |
Returns a dictionary representation of the ContactPersonDesc.
The format is the same as a pysaml2 configuration for a contact person.
:rtype: dict[str, str]
:return: A dictionary representation | def to_dict(self):
"""
Returns a dictionary representation of the ContactPersonDesc.
The format is the same as a pysaml2 configuration for a contact person.
:rtype: dict[str, str]
:return: A dictionary representation
"""
person = {}
if self.contact_type:
... |
Binds a logo to the given language
:type text: str
:type width: str
:type height: str
:type lang: Optional[str]
:param text: Path to logo
:param width: width of logo
:param height: height of logo
:param lang: language | def add_logo(self, text, width, height, lang=None):
"""
Binds a logo to the given language
:type text: str
:type width: str
:type height: str
:type lang: Optional[str]
:param text: Path to logo
:param width: width of logo
:param height: height of ... |
Returns a dictionary representation of the UIInfoDesc object.
The format is the same as a pysaml2 configuration for ui info.
:rtype: dict[str, str]
:return: A dictionary representation | def to_dict(self):
"""
Returns a dictionary representation of the UIInfoDesc object.
The format is the same as a pysaml2 configuration for ui info.
:rtype: dict[str, str]
:return: A dictionary representation
"""
ui_info = {}
if self._description:
... |
Returns a dictionary representation of the OrganizationDesc object.
The format is the same as a pysaml2 configuration for organization.
:rtype: dict[str, str]
:return: A dictionary representation | def to_dict(self):
"""
Returns a dictionary representation of the OrganizationDesc object.
The format is the same as a pysaml2 configuration for organization.
:rtype: dict[str, str]
:return: A dictionary representation
"""
org = {}
if self._display_name:
... |
Set an organization to the description
:type organization: satosa.metadata_creation.description.OrganizationDesc
:param organization: Organization description | def organization(self, organization):
"""
Set an organization to the description
:type organization: satosa.metadata_creation.description.OrganizationDesc
:param organization: Organization description
"""
if not isinstance(organization, OrganizationDesc):
rais... |
Adds a contact person to the description
:type person: satosa.metadata_creation.description.ContactPersonDesc
:param person: The contact person to be added | def add_contact_person(self, person):
"""
Adds a contact person to the description
:type person: satosa.metadata_creation.description.ContactPersonDesc
:param person: The contact person to be added
"""
if not isinstance(person, ContactPersonDesc):
raise TypeEr... |
Set an ui info to the description
:type ui_info: satosa.metadata_creation.description.UIInfoDesc
:param ui_info: The ui info to be set | def ui_info(self, ui_info):
"""
Set an ui info to the description
:type ui_info: satosa.metadata_creation.description.UIInfoDesc
:param ui_info: The ui info to be set
"""
if not isinstance(ui_info, UIInfoDesc):
raise TypeError("ui_info must be of type UIInfoDe... |
Returns a dictionary representation of the MetadataDescription object.
The format is the same as a pysaml2 configuration
:rtype: dict[str, Any]
:return: A dictionary representation | def to_dict(self):
"""
Returns a dictionary representation of the MetadataDescription object.
The format is the same as a pysaml2 configuration
:rtype: dict[str, Any]
:return: A dictionary representation
"""
description = {}
description["entityid"] = self.... |
See super class method satosa.frontends.base.FrontendModule#handle_authn_response
:type context: satosa.context.Context
:type internal_response: satosa.internal.InternalData
:rtype oic.utils.http_util.Response | def handle_authn_response(self, context, internal_resp, extra_id_token_claims=None):
"""
See super class method satosa.frontends.base.FrontendModule#handle_authn_response
:type context: satosa.context.Context
:type internal_response: satosa.internal.InternalData
:rtype oic.utils.... |
See super class satosa.frontends.base.FrontendModule
:type exception: satosa.exception.SATOSAError
:rtype: oic.utils.http_util.Response | def handle_backend_error(self, exception):
"""
See super class satosa.frontends.base.FrontendModule
:type exception: satosa.exception.SATOSAError
:rtype: oic.utils.http_util.Response
"""
auth_req = self._get_authn_request_from_state(exception.state)
# If the clien... |
See super class satosa.frontends.base.FrontendModule
:type backend_names: list[str]
:rtype: list[(str, ((satosa.context.Context, Any) -> satosa.response.Response, Any))]
:raise ValueError: if more than one backend is configured | def register_endpoints(self, backend_names):
"""
See super class satosa.frontends.base.FrontendModule
:type backend_names: list[str]
:rtype: list[(str, ((satosa.context.Context, Any) -> satosa.response.Response, Any))]
:raise ValueError: if more than one backend is configured
... |
Validates that all necessary config parameters are specified.
:type config: dict[str, dict[str, Any] | str]
:param config: the module config | def _validate_config(self, config):
"""
Validates that all necessary config parameters are specified.
:type config: dict[str, dict[str, Any] | str]
:param config: the module config
"""
if config is None:
raise ValueError("OIDCFrontend conf can't be 'None'.")
... |
Handle the OIDC dynamic client registration.
:type context: satosa.context.Context
:rtype: oic.utils.http_util.Response
:param context: the current context
:return: HTTP response to the client | def client_registration(self, context):
"""
Handle the OIDC dynamic client registration.
:type context: satosa.context.Context
:rtype: oic.utils.http_util.Response
:param context: the current context
:return: HTTP response to the client
"""
try:
... |
Handle an authentication request and pass it on to the backend.
:type context: satosa.context.Context
:rtype: oic.utils.http_util.Response
:param context: the current context
:return: HTTP response to the client | def handle_authn_request(self, context):
"""
Handle an authentication request and pass it on to the backend.
:type context: satosa.context.Context
:rtype: oic.utils.http_util.Response
:param context: the current context
:return: HTTP response to the client
"""
... |
Parse and verify the authentication request into an internal request.
:type context: satosa.context.Context
:rtype: satosa.internal.InternalData
:param context: the current context
:return: the internal request | def _handle_authn_request(self, context):
"""
Parse and verify the authentication request into an internal request.
:type context: satosa.context.Context
:rtype: satosa.internal.InternalData
:param context: the current context
:return: the internal request
"""
... |
Construct the JWKS document (served at /jwks).
:type context: satosa.context.Context
:rtype: oic.utils.http_util.Response
:param context: the current context
:return: HTTP response to the client | def jwks(self, context):
"""
Construct the JWKS document (served at /jwks).
:type context: satosa.context.Context
:rtype: oic.utils.http_util.Response
:param context: the current context
:return: HTTP response to the client
"""
return Response(json.dumps(... |
Handle token requests (served at /token).
:type context: satosa.context.Context
:rtype: oic.utils.http_util.Response
:param context: the current context
:return: HTTP response to the client | def token_endpoint(self, context):
"""
Handle token requests (served at /token).
:type context: satosa.context.Context
:rtype: oic.utils.http_util.Response
:param context: the current context
:return: HTTP response to the client
"""
headers = {"Authorizat... |
Mako filter: used to extract scope from attribute
:param s: string to extract scope from (filtered string in mako template)
:return: the scope | def scope(s):
"""
Mako filter: used to extract scope from attribute
:param s: string to extract scope from (filtered string in mako template)
:return: the scope
"""
if '@' not in s:
raise ValueError("Unscoped string")
(local_part, _, domain_part) = s.partition('@')
return domain_... |
Converts attribute names from external "type" to internal
:type attribute_profile: str
:type external_attribute_names: list[str]
:type case_insensitive: bool
:rtype: list[str]
:param attribute_profile: From which external type to convert (ex: oidc, saml, ...)
:param ext... | def to_internal_filter(self, attribute_profile, external_attribute_names):
"""
Converts attribute names from external "type" to internal
:type attribute_profile: str
:type external_attribute_names: list[str]
:type case_insensitive: bool
:rtype: list[str]
:param ... |
Converts the external data from "type" to internal
:type attribute_profile: str
:type external_dict: dict[str, str]
:rtype: dict[str, str]
:param attribute_profile: From which external type to convert (ex: oidc, saml, ...)
:param external_dict: Attributes in the external format... | def to_internal(self, attribute_profile, external_dict):
"""
Converts the external data from "type" to internal
:type attribute_profile: str
:type external_dict: dict[str, str]
:rtype: dict[str, str]
:param attribute_profile: From which external type to convert (ex: oid... |
Converts the internal data to "type"
:type attribute_profile: str
:type internal_dict: dict[str, str]
:rtype: dict[str, str]
:param attribute_profile: To which external type to convert (ex: oidc, saml, ...)
:param internal_dict: attributes to map
:return: attribute valu... | def from_internal(self, attribute_profile, internal_dict):
"""
Converts the internal data to "type"
:type attribute_profile: str
:type internal_dict: dict[str, str]
:rtype: dict[str, str]
:param attribute_profile: To which external type to convert (ex: oidc, saml, ...)
... |
Attempts to serialize a version with the given serialization format.
Raises MissingValueForSerializationException if not serializable | def _serialize(self, version, serialize_format, context, raise_if_incomplete=False):
"""
Attempts to serialize a version with the given serialization format.
Raises MissingValueForSerializationException if not serializable
"""
values = context.copy()
for k in version:
... |
Sets or returns the option selected in a ButtonGroup by its text value. | def value_text(self):
"""
Sets or returns the option selected in a ButtonGroup by its text value.
"""
search = self._selected.get() # a string containing the selected option
# This is a bit nasty - suggestions welcome
for item in self._rbuttons:
if item.value ... |
Resizes the widget.
:param int width:
The width of the widget.
:param int height:
The height of the widget. | def resize(self, width, height):
"""
Resizes the widget.
:param int width:
The width of the widget.
:param int height:
The height of the widget.
"""
self._width = width
self._height = height
# update radio buttons width
f... |
Appends a new `option` to the end of the ButtonGroup.
:param string/List option:
The option to append to the ButtonGroup. If a 2D list is specified,
the first element is the text, the second is the value. | def append(self, option):
"""
Appends a new `option` to the end of the ButtonGroup.
:param string/List option:
The option to append to the ButtonGroup. If a 2D list is specified,
the first element is the text, the second is the value.
"""
self._options.ap... |
Insert a new `option` in the ButtonGroup at `index`.
:param int option:
The index of where to insert the option.
:param string/List option:
The option to append to the ButtonGroup. If a 2D list is specified,
the first element is the text, the second is the value. | def insert(self, index, option):
"""
Insert a new `option` in the ButtonGroup at `index`.
:param int option:
The index of where to insert the option.
:param string/List option:
The option to append to the ButtonGroup. If a 2D list is specified,
the f... |
Removes the first `option` from the ButtonGroup.
Returns `True` if an item was removed.
:param string option:
The value of the option to remove from the ButtonGroup. | def remove(self, option):
"""
Removes the first `option` from the ButtonGroup.
Returns `True` if an item was removed.
:param string option:
The value of the option to remove from the ButtonGroup.
"""
for existing_option in self._options:
if exist... |
Updates the callback command which is called when the ButtonGroup
changes.
Setting to `None` stops the callback.
:param callback command:
The callback function to call.
:param callback args:
A list of arguments to pass to the widgets `command`, defaults to
... | def update_command(self, command, args=None):
"""
Updates the callback command which is called when the ButtonGroup
changes.
Setting to `None` stops the callback.
:param callback command:
The callback function to call.
:param callback args:
A li... |
Resets the combo box to the original "selected" value from the
constructor (or the first value if no selected value was specified). | def select_default(self):
"""
Resets the combo box to the original "selected" value from the
constructor (or the first value if no selected value was specified).
"""
if self._default is None:
if not self._set_option_by_index(0):
utils.error_format(self... |
Insert a new `option` in the Combo at `index`.
:param int option:
The index of where to insert the option.
:param string option:
The option to insert into to the Combo. | def insert(self, index, option):
"""
Insert a new `option` in the Combo at `index`.
:param int option:
The index of where to insert the option.
:param string option:
The option to insert into to the Combo.
"""
option = str(option)
self._o... |
Removes the first `option` from the Combo.
Returns `True` if an item was removed.
:param string option:
The option to remove from the Combo. | def remove(self, option):
"""
Removes the first `option` from the Combo.
Returns `True` if an item was removed.
:param string option:
The option to remove from the Combo.
"""
if option in self._options:
if len(self._options) == 1:
... |
Clears all the options in a Combo | def clear(self):
"""
Clears all the options in a Combo
"""
self._options = []
self._combo_menu.tk.delete(0, END)
self._selected.set("") |
Sets a single option in the Combo, returning True if it was able too. | def _set_option(self, value):
"""
Sets a single option in the Combo, returning True if it was able too.
"""
if len(self._options) > 0:
if value in self._options:
self._selected.set(value)
return True
else:
return Fal... |
Sets a single option in the Combo by its index, returning True if it was able too. | def _set_option_by_index(self, index):
"""
Sets a single option in the Combo by its index, returning True if it was able too.
"""
if index < len(self._options):
self._selected.set(self._options[index])
return True
else:
return False |
Call `function` after `time` milliseconds. | def after(self, time, function, args = []):
"""Call `function` after `time` milliseconds."""
callback_id = self.tk.after(time, self._call_wrapper, time, function, *args)
self._callback[function] = [callback_id, False] |
Repeat `function` every `time` milliseconds. | def repeat(self, time, function, args = []):
"""Repeat `function` every `time` milliseconds."""
callback_id = self.tk.after(time, self._call_wrapper, time, function, *args)
self._callback[function] = [callback_id, True] |
Cancel the scheduled `function` calls. | def cancel(self, function):
"""Cancel the scheduled `function` calls."""
if function in self._callback.keys():
callback_id = self._callback[function][0]
self.tk.after_cancel(callback_id)
self._callback.pop(function)
else:
utils.error_format("Could ... |
Fired by tk.after, gets the callback and either executes the function and cancels or repeats | def _call_wrapper(self, time, function, *args):
"""Fired by tk.after, gets the callback and either executes the function and cancels or repeats"""
# execute the function
function(*args)
if function in self._callback.keys():
repeat = self._callback[function][1]
if ... |
Resizes the widget.
:param int width:
The width of the widget.
:param int height:
The height of the widget. | def resize(self, width, height):
"""
Resizes the widget.
:param int width:
The width of the widget.
:param int height:
The height of the widget.
"""
self._width = width
self._height = height
if width != "fill":
self._s... |
Converts a color from "color", (255, 255, 255) or "#ffffff" into a color tk
should understand. | def convert_color(color):
"""
Converts a color from "color", (255, 255, 255) or "#ffffff" into a color tk
should understand.
"""
if color is not None:
# is the color a string
if isinstance(color, str):
# strip the color of white space
color = color.strip()
... |
Sets a callback for a ref (reference), setting to None will remove it | def set_callback(self, ref, callback):
"""
Sets a callback for a ref (reference), setting to None will remove it
"""
# if the callback already exists, remove it
self.remove_callback(ref)
# add it to the callbacks
if callback is not None:
self._callbac... |
Rebinds the tk event, only used if a widget has been destroyed
and recreated. | def rebind(self, tks):
"""
Rebinds the tk event, only used if a widget has been destroyed
and recreated.
"""
self._tks = tks
for tk in self._tks:
tk.unbind_all(self._tk_event)
func_id = tk.bind(self._tk_event, self._event_callback)
self... |
Returns the event callback for a ref (reference) | def get_event(self, ref):
"""
Returns the event callback for a ref (reference)
"""
# is this reference one which has been setup?
if ref in self._refs:
return self._refs[ref].get_callback(ref)
else:
return None |
Sets a callback for this widget against a ref (reference) for a
tk_event, setting the callback to None will remove it. | def set_event(self, ref, tk_event, callback):
"""
Sets a callback for this widget against a ref (reference) for a
tk_event, setting the callback to None will remove it.
"""
# has an EventCallback been created for this tk event
if tk_event not in self._event_callbacks:
... |
Removes an event for a ref (reference), | def remove_event(self, ref):
"""
Removes an event for a ref (reference),
"""
# is this reference one which has been setup?
if ref in self._refs:
self._refs[ref].remove_callback(ref) |
Rebinds all the tk events, only used if a tk widget has been destroyed
and recreated. | def rebind_events(self, *tks):
"""
Rebinds all the tk events, only used if a tk widget has been destroyed
and recreated.
"""
for ref in self._refs:
self._refs[ref].rebind(tks) |
Sets the border thickness and color.
:param int thickness:
The thickenss of the border.
:param str color:
The color of the border. | def set_border(self, thickness, color="black"):
"""
Sets the border thickness and color.
:param int thickness:
The thickenss of the border.
:param str color:
The color of the border.
"""
self._set_tk_config("highlightthickness", thickness)
... |
Resizes the widget.
:param int width:
The width of the widget.
:param int height:
The height of the widget. | def resize(self, width, height):
"""
Resizes the widget.
:param int width:
The width of the widget.
:param int height:
The height of the widget.
"""
self._set_propagation(width, height)
super(Box, self).resize(width, height) |
Hide the window. | def hide(self):
"""Hide the window."""
self.tk.withdraw()
self._visible = False
if self._modal:
self.tk.grab_release() |
Show the window. | def show(self, wait = False):
"""Show the window."""
self.tk.deiconify()
self._visible = True
self._modal = wait
if self._modal:
self.tk.grab_set() |
Destroy and close the App.
:return:
None.
:note:
Once destroyed an App can no longer be used. | def destroy(self):
"""
Destroy and close the App.
:return:
None.
:note:
Once destroyed an App can no longer be used.
"""
# if this is the main_app - set the _main_app class variable to `None`.
if self == App._main_app:
App._m... |
Resizes the widget.
:param int width:
The width of the widget.
:param int height:
The height of the widget. | def resize(self, width, height):
"""
Resizes the widget.
:param int width:
The width of the widget.
:param int height:
The height of the widget.
"""
# set the internal listbox width to be 0 as otherwise it maintains a default
# size and y... |
Draws a line between 2 points
:param int x1:
The x position of the starting point.
:param int y1:
The y position of the starting point.
:param int x2:
The x position of the end point.
:param int y2:
The y position of the end point.
... | def line(self, x1, y1, x2, y2, color="black", width=1):
"""
Draws a line between 2 points
:param int x1:
The x position of the starting point.
:param int y1:
The y position of the starting point.
:param int x2:
The x position of the end poin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.