Multiple environments


#1

Hi,

I have to support multiple authenticator services for all controllers of a play application:

  1. When the application is accessed via internet, a Cookie is provided from an IAM (Reverse Proxy)
  2. Otherwise a via Sign-In a Form is provided (that uses CookieAuthenticator)

Is there a easy way to support this scenario?
Should i create multiple environments or implement a custom Authenticator?

Thanks
Stefan


#2

Hi,

do you mean that you have two different cookies, that should be used to authenticate against a single controller? Do you have different user models, based on the different cookies?
Also, you write that you have to support different authenticator services? What kind of different authenticator services do you need for your app?

Best regards,
Christian


#3

Hi Christian

I have the same user model but different Authenticators.

i managed to get this working using the same Authenticator and using a custon RequestProvider for the IAM case that. But i have to use the same Authenticator and this is not what i like.

I would like to use a Cookie Authenticator for the IAM case and a SessionAuthenticator for the Login via Form.

But you can think of a simpler scenario: how would i support a login via O-Auth2 (Google) and via own login / username as supported by this forum?


#4

Hi,

But you can think of a simpler scenario: how would i support a login via O-Auth2 (Google) and via own login / username as supported by this forum?

This scenario isn’t authenticator dependent. I’ll quote myself from a another post:

an authenticator is like a session. It authenticates an already authenticated user on subsequent requests to a page/app. A provider is the part which authenticates a user against an external (social provider, LDAP, CAS), against a credentials provider and so on. Typically authentication in Silhouette has two steps. First the user authenticates once against a provider and then you create an authenticator which authenticates the user on subsequent request against your page/app.

i managed to get this working using the same Authenticator and using a custon RequestProvider for the IAM case that. But i have to use the same Authenticator and this is not what i like.

Here I can also quote myself from the same post:

A request provider is a special kind of provider which can be directly hooked into the authentication process. It reads authentication data from the incoming request and authenticates the user. In this case an authenticator isn’t used, therefore it’s recommended to use the DummyAuthenticator . The basic authentication provider is a request provider. It gets the authentication data from the Authorization header.

To give you a better advice, it would be great if you could describe your authentication flow a bit more in detail. I have the feeling that you currently mix the paradigms that Silhouette does provides.

Let me know if you have further questions.

Best regards,
Christian


#5

Hi Christian

Thank you for your answer. I think i get it now. I have to use a custom RequestProvider to handle the IAM token and use the CookieAuthenticator to handle the login via Form.

Best Regards,
Stefan