-
Notifications
You must be signed in to change notification settings - Fork 473
Conversation
ccc8c66
to
10f5ae7
Compare
This is an introduction to LDAP support. This PR includes the code that allows an LDAP user to authenticate in Portus. Some considerations:
The thing is that we need to register LDAP users in Portus' DB, but we want to do this transparently to LDAP users. Therefore, when an LDAP user signs in Portus for the first time, it will be created automatically in Portus' database, and a proper username will be created for said user if its username is not valid for Docker (as explained previously). But of course we've got a problem, since we require the This situation can be better. Basically we can add a configuration option in the
My idea is that if the admin set neither of the previous options, Portus would fallback to the current behavior. This way we would act safely, while being as clever as possible. The implementation of the above points should be done in another PR though. There are more crazy ideas that are related to LDAP support. One that occurred to me is to automatically create namespaces/teams from the organizations defined in the LDAP server (with users also being mapped into it automatically). Moreover, the configuration format has changed a little (and it needs further changing but I'll do that later on another PR). Notice that now each key defines a APP_CONFIG.enabled?("ldap") The specific configuration options for LDAP support are quite basic:
|
By the way, notice that LDAP users would need to use their |
Travis' failure is regarding a change from @jordimassaguerpla that will be superseded by #297. That's why I didn't fix it. |
format: { with: /\A[a-z0-9]{4,30}\Z/, | ||
message: 'Accepted format: "\A[a-z0-9]{4,30}\Z"' } | ||
format: { with: USERNAME_FORMAT, | ||
message: "Only alphanumeric characters are allowed" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we say also "minimum 4 and maximum 30"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
a part from the small issue with the message, all the rest lgtm, but I am no expert. Let's see what flavio says. |
@@ -136,6 +136,7 @@ | |||
t.datetime "updated_at" | |||
t.boolean "admin", limit: 1, default: false | |||
t.boolean "enabled", limit: 1, default: true | |||
t.string "ldap_name", limit: 255, default: "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think two different users can end up having the same ldap_name
? I think we should add a unique index on it.
We have to make sure the LDAP server is always contacted, the password inside of our DB should be omitted for users registered via LDAP |
We should also notice clashes inside of the |
LGTM 👏 |
One last thing about the screenshot you posted: IMHO the form should fill the entire page, right now there's a lot of empty space on the right side of the screen. However I think that's a problem that has always afflicted the page. |
@flavio on the layout of the profile page, yes, this has been like that since always. We can fix that in another PR. |
Implemented the code to avoid name clashes:
|
|
@flavio I say let the |
Sorry, I missed that. LGTM |
@flavio you didn't miss it, it's not implemented yet :D |
f3ecda9
to
e397a8e
Compare
This should be it. Last changes:
|
fail!(:invalid_login) | ||
end | ||
else | ||
# rubocop:disable Style/SignalException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being there means:
- ldap is disabled
- ldap is enabled, but the user cannot be found on the remote server
The next action is fail
which moves to the next authentication strategy (portus' db). I think it would be better to distinguish the second case and fail immediately. I think that once LDAP is enable we should not allow a mixed authentication strategy.
Did I get something wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. I'd be for with a mixed authentication strategy. For example, how would you create the admin user if LDAP is enabled if you don't allow a mixed solution ?
205e5e0
to
297edab
Compare
This is an introduction to LDAP support. There are some questions that need to be addressed, but at least the basic structure is in place now. Fixes SUSE#150 Signed-off-by: Miquel Sabaté Solà <[email protected]>
After a bit of discussion, we're going for a "strict" LDAP support. That is, if LDAP support is enabled, then only LDAP users can log in Portus. This can be put as a configurable value in the future if users request the "mixed" approach. With this, I've updated the patch so:
I've updated the patch to reflect this changes. |
LGTM. BTW, in the future it would be better to avoid the merge of all the commits for big pull requests like this; it's painful to review the whole diff all the times to spot only a few changes. Proposal: for PR like this one let's merge the the commits only before doing the real merge. |
@flavio sounds reasonable to me |
This is an introduction to LDAP support. There are some questions that need to
be addressed, but at least the basic structure is in place now.
Fixes #150
Signed-off-by: Miquel Sabaté Solà [email protected]