opensmarthouse / opensmarthouse-core

Eclipse Public License 2.0
7 stars 0 forks source link

Reorganize authentication handling to reflect initial design #16

Open splatch opened 3 years ago

splatch commented 3 years ago

Currently core.auth module contains bunch of implementations which should go to core.auth.core. I am sure that handling of apitoken is essential, yet it should be a separate module and separate credential type.

Also present state of auth handling breaks primary principle from times it was first designed where there was:

  1. Credential Extractor (a context specific type which is responsible for sourcing auth information)
  2. Authentication Provider (realization of authentication logic)
  3. Authentication Manager (entry point to perform authentication)

At present handling of JWT is done in authentication filter down in rest.auth. Given that JWT is rather standardized kind of credentials we are able to create valid extractor as well as implement relevant authentication provider who will handle this kind of credentials. Main point of this is to support federated login operations when user identity is managed externally from OH (ie. in NAS system prefered by user).