Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microservice may need access to satosa configuration #255

Open
rhoerbe opened this issue Jul 12, 2019 · 4 comments
Open

Microservice may need access to satosa configuration #255

rhoerbe opened this issue Jul 12, 2019 · 4 comments

Comments

@rhoerbe
Copy link
Contributor

rhoerbe commented Jul 12, 2019

Use Case: see issue #218
Or: a pair of request/response microservice need to share state via a cookie. Currently, the cookie name needs to be hard coded or configured twice.

Code Version

4.4.0

Expected Behavior

To provide the microservice with the backend entityID it needs to have access to the backend (or the complete proxy) configuration.

Current Behavior

Microservices get only their specific configuration

Possible Solution

Make configuration a singleton that can be imported on demand by any module.

@c00kiemon5ter
Copy link
Member

c00kiemon5ter commented Jul 12, 2019

I don't think issue #21 is the one you wanted to share. I'm curious to see what the use case actually is.

One thing you need to keep in mind is that Satosa does not differentiate how things happen based on the protocols (ie, the backends or frontends). Instead, it normalizes the different protocols in a common internal representation. If you request something specific to a protocol, then this is probably something that belongs to the respective backend or frontend.


a pair of request/response microservice need to share state via a cookie. Currently, the cookie name needs to be hard coded or configured twice.

Using the cookie is the only mechanism available (right now) to share data that will last throughout the flow. Each micro-service is responsible for the things it looks and puts into the state object (the cookie). You cannot go around this. The cookie name should be the micro-service name. This should be part of an API that imposes some rules on how one can store things into the state.


Make configuration a singleton that can be imported on demand by any module.

The singleton is one of the worst patterns. It is barely useful at all. It effectively works as global state, and we will try to have as little as possible of it.


Let me understand the use case, and we will see what the different approaches to this are.

@rhoerbe
Copy link
Contributor Author

rhoerbe commented Jul 12, 2019 via email

@peppelinux
Copy link
Member

peppelinux commented Aug 1, 2019

in this place:
https://github.com/IdentityPython/SATOSA/blob/master/src/satosa/base.py#L89
we could pass proxy config as argument or, better, call in the MS constructor a global function that does the following actions before returning satosa_config:

config_file = os.environ.get("SATOSA_CONFIG", "proxy_conf.yaml")
satosa_config = SATOSAConfig(config_file)

This idea could introduce in addition also a refactor of this:
https://github.com/IdentityPython/SATOSA/blob/master/src/satosa/wsgi.py#L12

moving it to a specialized function, importable everywhere, to get proxy configuration where needed. I think this is a better strategy to avoid passing configuration as argument in MS init and also better than leave that global vars there.

@ioparaskev
Copy link
Contributor

maybe we should keep the conversation either here or in the mailing list (in the mailing list there is more discussion), otherwise it would be difficult to keep track of the conversation and reach a consensus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants