Commit Graph

69 Commits

Author SHA1 Message Date
Pavel Sorokin 2362556f80 Fix return value 2017-12-17 23:23:41 +08:00
Pavel Sorokin 28f88ec62c Fix return statements 2017-12-17 18:35:55 +08:00
Pavel Sorokin 4e15f2383b Fix default_provider error handling 2017-12-12 22:18:01 +08:00
Pavel Sorokin 706c109ac0 Merge branch 'master' of https://github.com/bitly/oauth2_proxy into work 2017-12-11 12:21:22 +00:00
Pavel Sorokin 0a334b7cf4 Merge branch 'master' of https://github.com/bitly/oauth2_proxy into work 2017-12-11 07:37:05 +00:00
Mark Maglana 882fcf0a01 providers: iterate across all pages from /user/orgs github endpoint.
For some GHE instances where a user can have more than 100
organizations, traversing the other pages is important otherwise
oauth2_proxy will consider the user unauthorized. This change traverses
the list returned by the API to avoid that.

Update github provider tests to include this case.
2017-12-04 15:51:48 -05:00
Carlo Lobrano 731fa9f8e0 Github provider: use login as user
- Save both user and email in session state:
    Encoding/decoding methods save both email and user
    field in session state, for use cases when User is not derived from
    email's local-parth, like for GitHub provider.

    For retrocompatibility, if no user is obtained by the provider,
    (e.g. User is an empty string) the encoding/decoding methods fall back
    to the previous behavior and use the email's local-part

    Updated also related tests and added two more tests to show behavior
    when session contains a non-empty user value.

- Added first basic GitHub provider tests

- Added GetUserName method to Provider interface
    The new GetUserName method is intended to return the User
    value when this is not the email's local-part.

    Added also the default implementation to provider_default.go

- Added call to GetUserName in redeemCode

    the new GetUserName method is used in redeemCode
    to get SessionState User value.

    For backward compatibility, if GetUserName error is
    "not implemented", the error is ignored.

- Added GetUserName method and tests to github provider.
2017-11-20 20:02:27 +01:00
Tanvir Alam a7c5d9c478
Merge pull request #421 from arnottcr/raw-url-encode
raw url encoding
2017-11-20 10:50:56 -05:00
Pavel Sorokin 6edba8d9fb More debug and workaround for accessing GRAPH 2017-11-16 13:14:27 +00:00
Tanvir Alam f2a995b8d9 providers: update gitlab api endpoint to use latest version, v4 2017-11-06 12:05:58 -05:00
Tanvir Alam 8a77cfcac3 Swap out bmizerany/assert package that is deprecated in favor of stretchr/testify/assert 2017-10-23 12:24:17 -04:00
Jehiah Czebotar b7f9438b8a Merge pull request #473 from jmcarp/oidc-name
Add OpenID Connect provider name.
2017-10-13 09:10:44 -04:00
Joshua Carp d118cb7bbb Drop deprecated MyUSA provider.
[Resolves #390]
2017-10-08 01:01:15 -04:00
Joshua Carp 34d96f8d84 Add OpenID Connect provider name. 2017-10-08 00:40:36 -04:00
Miouge1 a32ff08d68 Update test for default GitLab scope 2017-09-12 23:43:49 +02:00
Miouge1 982439a8d8 Reduce the default GitLab scope 2017-09-12 23:42:07 +02:00
Jehiah Czebotar e87c3eee13 Merge pull request #389 from ericchiang/oidc-provider
*: add an OpenID Connect provider
2017-09-09 20:44:59 -04:00
Eric Chiang cb48577ede *: add an OpenID Connect provider
See the README for usage with Dex or any other OIDC provider.

To test run a backend:

    python3 -m http.server

Run dex and modify the example config with the proxy callback:

    go get github.com/coreos/dex/cmd/dex
    cd $GOPATH/src/github.com/coreos/dex
    sed -i.bak \
      's|http://127.0.0.1:5555/callback|http://127.0.0.1:5555/oauth2/callback|g' \
       examples/config-dev.yaml
    make
    ./bin/dex serve examples/config-dev.yaml

Then run the oauth2_proxy

    oauth2_proxy \
      --oidc-issuer-url http://127.0.0.1:5556/dex \
      --upstream http://localhost:8000 \
      --client-id example-app \
      --client-secret ZXhhbXBsZS1hcHAtc2VjcmV0 \
      --cookie-secret foo \
      --email-domain '*' \
      --http-address http://127.0.0.1:5555 \
      --redirect-url http://127.0.0.1:5555/oauth2/callback \
      --cookie-secure=false

Login with the username/password "admin@example.com:password"
2017-09-08 09:32:51 -07:00
Pavel Sorokin 16fe3d121d Merge branch 'master' of https://github.com/bitly/oauth2_proxy 2017-09-07 13:54:56 +08:00
Pavel Sorokin 4f67c1acd4 Add "resource" to LoginURL if defined. That helps to get 2FA 2017-09-07 13:53:53 +08:00
Colin Arnott ba67e5c847
strip all log statements with the endpoint var 2017-07-13 18:33:48 +00:00
Colin Arnott 8d6e16bf22
use base64.RawURLEncoding.DecodeString() in place of a bespoke function 2017-07-13 18:29:58 +00:00
Pavel Sorokin d181279917 Test fixes 2017-06-28 11:34:25 +08:00
Pavel Sorokin 2c5f6145aa Fix for google_test validation 2017-06-27 23:26:38 +08:00
Pavel Sorokin b801997624 Fix incorrect "state" header 2017-06-26 06:21:38 +00:00
Pavel Sorokin 47fe902cbc Merge branch 'master' of https://github.com/bitly/oauth2_proxy into HEAD 2017-06-22 03:06:56 +00:00
Colin Arnott 17b1fa31dd
use Authorization header, not access_token query parameter 2017-05-18 03:45:34 +00:00
Pavel Sorokin 5b0e28fcbe Add unittests for group filtering (Azure) (#1)
* Add unittests for group filtering (Azure)
2017-04-03 12:40:44 -07:00
Pavel Sorokin 342cac58ca Fix group limits and original azure unit tests 2017-04-03 12:40:44 -07:00
Brandon Matthews b546ef4a3f Add support for permitted groups 2017-04-03 12:40:44 -07:00
Brandon Matthews 2fd6f02cd8 Add support for a simple group filter 2017-04-03 12:40:44 -07:00
Brandon Matthews 5e5717ded7 Add support for passing groups from Azure AD 2017-04-03 12:40:43 -07:00
Brandon Matthews 6cbed581c2 Change session cookie delimeter to colon from pipe
This is to permit us to store a user's Groups in a pipe-delimited list
without fear of bad splits or having to reassemble it in transit.
2017-04-03 12:24:51 -07:00
Jehiah Czebotar c5fc7baa86 gofmt 2017-03-29 09:36:38 -04:00
Colin Arnott 55085d9697 csrf protection; always set state 2017-03-29 09:31:10 -04:00
Jehiah Czebotar cd0d13e3fb Merge pull request #357 from wrapp/skip-group-lookup-404
Skip 404 errors when looking up Google groups
2017-03-28 21:38:55 -04:00
Colin Arnott 289a6ccf46 add check for //.* to prevent open redirect during oauth 2017-03-28 21:12:33 -04:00
Eskil Andreen 652f43ed38 Skip 404 errors when looking up Google groups
When checking user membership against Google groups the groups are checked one
at a time and in the order that they were supplied. If one of the groups does
not exist then the checking is halted with the following error.

google.go:201: googleapi: Error 404: Resource Not Found: groupKey, notFound

None of the groups following the missing group are checked either. This means
that something as trivial as a typo in the first group will make it impossible
for anybody to login.

This change catches the 404, logs a message, and then carries on as usual. In
this way a typo will cause a particular group to stop working but will not
affect any other groups.
2017-03-28 16:06:15 +02:00
nickmiller-wf c566648127 add stripParam and stripToken methods to obfuscate log output 2016-08-02 21:01:44 -06:00
Tomas Pramuka 5acf96b75d Getting mail for Azure provider fix + tests 2016-06-29 09:00:08 +02:00
Jehiah Czebotar a0763477c5
Facebook Authentication Provider
* will not re-prompt if the email permission is denied, or if you previously authorized the same FB app without the email scope.
2016-06-23 08:43:21 -04:00
Jehiah Czebotar bcb8064831
github: fix github enterprise support 2016-06-20 08:15:07 -04:00
Jehiah Czebotar cdebfd6436
base64 cookie support 2016-06-20 07:45:43 -04:00
Jehiah Czebotar 293d674e14 Merge pull request #214 from raphink/github_multiple_teams
github provider: allow multiple teams
2016-02-17 17:24:50 -05:00
Raphaël Pinson 338e99773a github provider: allow multiple teams 2016-02-17 23:17:08 +01:00
pmosbach 034612bf8b Add GitLab provider 2016-02-17 06:19:52 -06:00
Jehiah Czebotar 36128e971f Merge pull request #197 from ruta-goomba/enterprise-github
use Github provider with GitHub enterprise
2016-02-06 13:24:48 -06:00
Ruta Sakalauskaite a9cf8b3313 adding enterprise github provider
print the error stack trace

point to my fork in oauthproxy.go

addint pointers to ruta-goomba fork in mulitple files

change api endpoint

replace hard-coded github api endpoint with variables

resetting fall through github urls to point to github.com

fix malformed url

changes to enable use with enterprise github
2016-01-21 21:22:18 +00:00
Eelco Cramer 10f47e325b Add Azure Provider 2016-01-20 03:57:17 -05:00
Brandon Philips 51a2e4e48c *: rename Url to URL everywhere
Go coding style says that acronyms should be all lower or all upper. Fix
Url to URL.
2015-11-09 00:47:44 +01:00