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

Q: Multi-tenant app support? #14

Closed
iambmelt opened this issue Sep 28, 2015 · 4 comments
Closed

Q: Multi-tenant app support? #14

iambmelt opened this issue Sep 28, 2015 · 4 comments

Comments

@iambmelt
Copy link
Member

Does using omniauth-azure-activedirectory preclude my app from being multi-tenant? I see that in the below file a tenant identifier is expected; how does that impact me?


From examples/rails-todo-list-app/config/environment.rb

# You may want to specify these keys separately for production and test
# environments.
ENV['CLIENT_ID'] = 'YOUR CLIENT ID HERE'
ENV['CLIENT_SECRET'] = 'YOUR CLIENT SECRET HERE'
ENV['TENANT'] ='YOUR TENANT HERE'

# Load the Rails application.
require File.expand_path('../application', __FILE__)

ADAL::Logging.log_level = ADAL::Logger::VERBOSE

# Initialize the Rails application.
Rails.application.initialize!
@iambmelt
Copy link
Member Author

Answered my own question - it looks like the tenant is used for looking up the app registration and not much else....

So multi-tenant is good 👍

@ricalo
Copy link

ricalo commented Jan 6, 2016

@iambmelt, actually, the tenant is used to validate the JWT token.
The validation occurs in validate_and_parse_id_token

So, any user from a tenant that is different from ENV['TENANT'] will fail the token validation.

I believe this effectively prevents your app from being multi-tenant.

@aj-michael could you confirm/discard this hypothesis?

@aj-michael
Copy link
Contributor

@ricalo No, I do not believe tenant is checked in that method. I cannot currently test this, but that method checks the JWT for expiration, issued at, audience (client id), issuer, not before, and signature.

@ricalo
Copy link

ricalo commented Jan 6, 2016

Thanks for the prompt answer, @aj-michael

I think the key is that the method checks for payload['iss'].to_s == options['iss'].to_s
The validate_and_parse_id_token method throws an error if the user's tenant is different than the tenant configured by the library.

Currently, I see no way of configure the library to use the common tenant, so I can sign-in with users from multiple tenants.

Here's the error that I see when I try to configure the library with the common tenant.
invalidissuer

I guess the question here is how do I configure the library to support users from multiple tenants?

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

3 participants