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

Feature Request - Swap/replace Server Credential Store #355

Open
jdobrzanski opened this issue May 31, 2018 · 5 comments
Open

Feature Request - Swap/replace Server Credential Store #355

jdobrzanski opened this issue May 31, 2018 · 5 comments

Comments

@jdobrzanski
Copy link

Want the ability to timeout sessions server side. I've add a Coherence.DbStore protocol impl that uses Redis for storage and TTL but the credentials are still stored and first accessed from the Coherence.CredentialStore.Server. How can I bypass this behavior? I want the primary credential store to be the Redis store or allow TTL within the Coherence.CredentialStore.Server. Technically I could keep shutting down the GenServer to clear its state and force a reload from the Redis cache but this is hack-ish. Thoughts?

@smpallen99
Copy link
Owner

You have a number of choices. You could implement you own Session plug and replace the calls to Coherence.Authentication.Session in ur router. Alternatively, Coherence.Authentication.Session takes a :store option that defaults to store = Keyword.get(opts, :store, Coherence.CredentialStore.Session)

So you could implement ur own CredentialStore by cloning and modifying Coherence.CredentialStore.Session.

@jdobrzanski
Copy link
Author

The first option is what I wanted to do but a hardcoded case statement in deps/coherence/lib/coherence/plugs/authorization/utils.ex in the function get_credential_store/0 breaks when one tries to configure the :auth_module to something custom in the config. Ultimately, and very unfortunately, for this and other reasons/needs I was forced to fork coherence.

  @spec get_credential_store() :: module
  def get_credential_store do
    case Config.auth_module do
      Coherence.Authentication.Session ->
        Coherence.CredentialStore.Session
      Coherence.Authentication.Basic ->
        Coherence.CredentialStore.Server
    end
  end

@jdobrzanski
Copy link
Author

For more clarification, lib/coherence/supervisor.ex calls Coherence.Authentication.Utils. get_credential_store/0 when setting up the supervising tree before the config is loaded. This makes creating a custom version of the Coherence.Authentication.Session plug difficult.

@smpallen99
Copy link
Owner

I have done some significant changes to the controller design. One of those changes is allowing customization of the get_credential_store. The work is on a branch right now. I've upgraded my current active project over to the new design and working through regression testing. When I'm happy, I'll merge the changes into master and then ultimately release 0.6.0.

@smpallen99
Copy link
Owner

I should be merging the extendible-controllers branch to master soon. I want to soak it a little longer on my personal project.

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

2 participants