22 Commits

Author SHA1 Message Date
Chenxiong Qi
d1026c0df7 Do not drop realm from user's kerberos principal name
Save the realm and just keep the variable there for any further possible
use.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-10-25 13:46:54 +08:00
Chenxiong Qi
9fd3731ff7 Remove KerberosAuthenticate and get kerberos username from REMOTE_USER
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-10-17 10:20:59 +08:00
Valerij Maljulin
2c0291987f Raise Unathorized exception instead of general one whenever OIDC auth fails
This fixes #1147
2019-10-03 17:02:33 +02:00
mprahl
8c6cfb702d Use small license headers in the Python files
This also removes the outdated comments around authorship of each
file. If there is still interest in this information, one can just
look at the git history.
2019-10-03 08:47:24 -04:00
Chenxiong Qi
e6aa47e02a Use set literal to create a set
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-15 21:14:02 +08:00
mprahl
66c3f82160 Format the coding style across the codebase using "black" and manual tweaks
The main benefit of this commit is that the use of double quotes
is now consistent.
2019-04-26 00:32:13 -04:00
Jan Kaluza
c5a9a1b8af Allow auth.get_user() method to be called multiple times.
The `ImportModuleAPI` calls the `auth.get_user()` which auths the
user using Kerberos. the `ImportModuleAPI` later calls `SCMHandler`
which in its `__init__` method calls the `auth.get_user()` again.
This leads to traceback in GSSAPI, because the user is already
authed.

This commit fixes this by caching the auth results in `flask.g`,
which is reset after each request based on the Note in
http://flask.pocoo.org/docs/1.0/appcontext/#storing-data.

This commit also marks mutual auth as OPTIONAL in `mbs-cli`,
because MBS server currently does not do mutual auth.
2019-03-07 09:37:14 +01:00
mprahl
776330a2bb Add the allowed_users configuration for service accounts to bypass the group membership check
This is required for monitoring use-cases, where we can have a Kerberos principal for a
service account but no associated account in LDAP to check group membership.
2019-02-14 11:11:18 -05:00
mprahl
e91d09f7ca Change the format of the unit tests to pytest 2018-01-31 16:34:21 -05:00
Martin Curlej
60b3d97c97 flake8 cleanup
Signed-off-by: Martin Curlej <mcurlej@redhat.com>

removed some noqa tags
2017-10-25 12:13:59 +02:00
mprahl
0f6d7a55c5 Add Kerberos + LDAP authentication support 2017-09-15 12:02:57 -04:00
Filip Valder
7ef2975984 PEP8 fixes 2017-07-17 18:29:10 +02:00
Jakub Kadlčík
8626f974cf Set anonymous owner when NO_AUTH 2017-03-30 11:01:13 +02:00
Jan Kaluza
34c8cc833a Fix tests and change two places where Forbidden is more accurate than Unauthorized. 2017-03-14 13:40:53 +01:00
Jan Kaluza
b11ea14358 Add OIDC_REQUIRED_SCOPE and fix the test_auth.py to use Authorization header. 2017-03-06 14:56:09 +01:00
Matt Jia
143effcd15 Error out if OIDC_CLIENT_SECRETS is not set in server config 2017-02-21 11:08:42 +10:00
Matt Jia
be65a0ff81 allow to explicitly disable client authentication 2017-02-21 11:08:37 +10:00
Ralph Bean
2887e71b29 Mark these functions as "private". 2017-02-10 15:53:36 -05:00
Ralph Bean
88aca055ce Replace query to FAS with OIDC groups scope check.
This removes our query to FAS and fixes #304.

It is more flexible too, where we can now configure production to only
allow in members of the `modularity-wg` group, and then later open it up
to all packagers after F26 is out (as was agreed with FESCo).

In the process of working on this, I discovered that #305 is not
necessary.  We don't need our own scope; we can just use the `groups`
scope as done here.
2017-02-10 15:50:41 -05:00
Jan Kaluza
8cb4e0de5d Use OIDC to auth the users, replace submit-build.sh by submit-build.py which does hackish way of OIDC just to test things. 2016-12-02 14:52:04 +01:00
Matt Prahl
b4082dc551 Rename module from rida to module_build_service
Rename routes from /rida/1/module-builds/ to /module-build-service/1/module-builds/
2016-10-24 10:30:23 -04:00
Ralph Bean
b12bda2d55 Check FAS for packager status, not pkgdb.
Before this, we were consulting pkgdb to see if the given user was the
maintainer of any packages.

That mostly works... but technically, we want to consult FAS to see if
the user is in the packager group.

We found this when @mprahl was unable to submit builds to rida.  I added
him to the packager group, but nothing changed!  (As written, he had to
actually own a package).

This change fixes all that so that we query FAS instead of pkgdb.

Tests are added.
2016-09-07 16:35:25 -04:00