Giter Club home page Giter Club logo

dex's Introduction

dex - A federated OpenID Connect provider

GitHub Workflow Status OpenSSF Scorecard Go Report Card Gitpod ready-to-code

logo

Dex is an identity service that uses OpenID Connect to drive authentication for other apps.

Dex acts as a portal to other identity providers through "connectors." This lets dex defer authentication to LDAP servers, SAML providers, or established identity providers like GitHub, Google, and Active Directory. Clients write their authentication logic once to talk to dex, then dex handles the protocols for a given backend.

ID Tokens

ID Tokens are an OAuth2 extension introduced by OpenID Connect and dex's primary feature. ID Tokens are JSON Web Tokens (JWTs) signed by dex and returned as part of the OAuth2 response that attest to the end user's identity. An example JWT might look like:

eyJhbGciOiJSUzI1NiIsImtpZCI6IjlkNDQ3NDFmNzczYjkzOGNmNjVkZDMyNjY4NWI4NjE4MGMzMjRkOTkifQ.eyJpc3MiOiJodHRwOi8vMTI3LjAuMC4xOjU1NTYvZGV4Iiwic3ViIjoiQ2djeU16UXlOelE1RWdabmFYUm9kV0kiLCJhdWQiOiJleGFtcGxlLWFwcCIsImV4cCI6MTQ5Mjg4MjA0MiwiaWF0IjoxNDkyNzk1NjQyLCJhdF9oYXNoIjoiYmk5NmdPWFpTaHZsV1l0YWw5RXFpdyIsImVtYWlsIjoiZXJpYy5jaGlhbmdAY29yZW9zLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJncm91cHMiOlsiYWRtaW5zIiwiZGV2ZWxvcGVycyJdLCJuYW1lIjoiRXJpYyBDaGlhbmcifQ.OhROPq_0eP-zsQRjg87KZ4wGkjiQGnTi5QuG877AdJDb3R2ZCOk2Vkf5SdP8cPyb3VMqL32G4hLDayniiv8f1_ZXAde0sKrayfQ10XAXFgZl_P1yilkLdknxn6nbhDRVllpWcB12ki9vmAxklAr0B1C4kr5nI3-BZLrFcUR5sQbxwJj4oW1OuG6jJCNGHXGNTBTNEaM28eD-9nhfBeuBTzzO7BKwPsojjj4C9ogU4JQhGvm_l4yfVi0boSx8c0FX3JsiB0yLa1ZdJVWVl9m90XmbWRSD85pNDQHcWZP9hR6CMgbvGkZsgjG32qeRwUL_eNkNowSBNWLrGNPoON1gMg

ID Tokens contains standard claims assert which client app logged the user in, when the token expires, and the identity of the user.

{
  "iss": "http://127.0.0.1:5556/dex",
  "sub": "CgcyMzQyNzQ5EgZnaXRodWI",
  "aud": "example-app",
  "exp": 1492882042,
  "iat": 1492795642,
  "at_hash": "bi96gOXZShvlWYtal9Eqiw",
  "email": "[email protected]",
  "email_verified": true,
  "groups": [
    "admins",
    "developers"
  ],
  "name": "Jane Doe"
}

Because these tokens are signed by dex and contain standard-based claims other services can consume them as service-to-service credentials. Systems that can already consume OpenID Connect ID Tokens issued by dex include:

For details on how to request or validate an ID Token, see "Writing apps that use dex".

Kubernetes and Dex

Dex runs natively on top of any Kubernetes cluster using Custom Resource Definitions and can drive API server authentication through the OpenID Connect plugin. Clients, such as the kubernetes-dashboard and kubectl, can act on behalf of users who can login to the cluster through any identity provider dex supports.

  • More docs for running dex as a Kubernetes authenticator can be found here.
  • You can find more about companies and projects, which uses dex, here.

Connectors

When a user logs in through dex, the user's identity is usually stored in another user-management system: a LDAP directory, a GitHub org, etc. Dex acts as a shim between a client app and the upstream identity provider. The client only needs to understand OpenID Connect to query dex, while dex implements an array of protocols for querying other user-management systems.

A "connector" is a strategy used by dex for authenticating a user against another identity provider. Dex implements connectors that target specific platforms such as GitHub, LinkedIn, and Microsoft as well as established protocols like LDAP and SAML.

Depending on the connectors limitations in protocols can prevent dex from issuing refresh tokens or returning group membership claims. For example, because SAML doesn't provide a non-interactive way to refresh assertions, if a user logs in through the SAML connector dex won't issue a refresh token to its client. Refresh token support is required for clients that require offline access, such as kubectl.

Dex implements the following connectors:

Name supports refresh tokens supports groups claim supports preferred_username claim status notes
LDAP yes yes yes stable
GitHub yes yes yes stable
SAML 2.0 no yes no stable WARNING: Unmaintained and likely vulnerable to auth bypasses (#1884)
GitLab yes yes yes beta
OpenID Connect yes yes yes beta Includes Salesforce, Azure, etc.
OAuth 2.0 no yes yes alpha
Google yes yes yes alpha
LinkedIn yes no no beta
Microsoft yes yes no beta
AuthProxy no yes no alpha Authentication proxies such as Apache2 mod_auth, etc.
Bitbucket Cloud yes yes no alpha
OpenShift yes yes no alpha
Atlassian Crowd yes yes yes * beta preferred_username claim must be configured through config
Gitea yes no yes beta
OpenStack Keystone yes yes no alpha

Stable, beta, and alpha are defined as:

  • Stable: well tested, in active use, and will not change in backward incompatible ways.
  • Beta: tested and unlikely to change in backward incompatible ways.
  • Alpha: may be untested by core maintainers and is subject to change in backward incompatible ways.

All changes or deprecations of connector features will be announced in the release notes.

Documentation

Reporting a vulnerability

Please see our security policy for details about reporting vulnerabilities.

Getting help

  • For feature requests and bugs, file an issue.
  • For general discussion about both using and developing Dex:

Development

When all coding and testing is done, please run the test suite:

make testall

For the best developer experience, install Nix and direnv.

Alternatively, install Go and Docker manually or using a package manager. Install the rest of the dependencies by running make deps.

License

The project is licensed under the Apache License, Version 2.0.

dex's People

Contributors

al45tair avatar alindeman avatar amrutac avatar bobcallaway avatar bonifaido avatar calpicow avatar ccojocar avatar cedric-magnan avatar dependabot[bot] avatar dhaus67 avatar dqminh avatar edtan avatar ericchiang avatar estroz avatar happy2c0de avatar heidemn-faro avatar joelspeed avatar jsoref avatar justaugustus avatar justin-slowik avatar krishnadurai avatar nabokihms avatar oded-b avatar pborzenkov avatar rithujohn191 avatar sabre1041 avatar sagikazarmark avatar squat avatar srenatus avatar vito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dex's Issues

storage: expire passwords

Issue by bobbyrullo
Thursday Jul 23, 2015 at 01:03 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/334


Right now Passwords have an expiration but it's set to 0, which means never expire.

Some admins might want to be able to expire passwords, in which case we need a way to expose policy to users, and some new flows for when a user needs to change their password upon logging in with an expired password...and maybe binary which runs every day and bugs people when their passwords are going to expire soon and also a pony.

idea: declarative token validation

Issue by sym3tri
Tuesday Jun 30, 2015 at 19:45 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/281


I've encountered jwt claim parsing/validation code very frequently. Just an idea, but maybe we create a generic way to declaratively "validate" tokens by ensuring a set of claims/values. I kinda want a function I can call like:

var (
  ErrorClaimMissing = ...
  ErrorClaimMatchFailure = ...
  ErrorClaimCheckInvalidType = ...
  ...
)

type ClaimCheck struct {
  name string
  value interface{} // must be a supported claim type
}

wantClaims := []ClaimCheck{
  // no value, just checks for existence
  ClaimCheck {
    name: "email",
  },
  // existence & equality check
  ClaimCheck {
    name: "aud",
    value: "some-clien-id",
  },
}

valid, err := jwt.HasExpected(wantClaims)
...

Thoughts?

Run OpenID self-certification testing suits, and get an OpenID Certification

Issue by yifan-gu
Friday Jul 24, 2015 at 19:36 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/336


OpenID Foundation provides a series of testing suits to verify the OpenID Connect implementation:
http://openid.net/certification/
We should go through these process and run the testing suit against our authd implementation. We should at least pass the OP basic and OP config profile before open sourcing authd.

If we want to get the certification mark, we would need to become a member of the foundation and submit a request.

/cc @bobbyrullo @bcwaldon @philips

Redirect URI vs URL

Issue by bcwaldon
Wednesday Feb 11, 2015 at 01:42 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/193


OAuth2 uses "URI" while we tend to use "URL" in the authd codebase (except for the HTTP API). Is it worth standardizing on URI internally? If we use URI internally within the context of ClientMetadata.RedirectURIs, do we need to then replace LoginURL with LoginURI?

"Remember me" when logging in

Issue by bobbyrullo
Thursday Jul 02, 2015 at 15:56 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/288


dex SSO:

To prevent people from having to type their email/passwords multiple times, we propose the following: after dex authenticates or registers, it drops a http-only cookie with a special JWT: one where the ISS and the AUD are the issuer (i.e., dex) Now, when a client app sends someone to authenticate via dex, if they have this cookie (and the JWT is valid, non-expired, etc.), dex will not require them to type a password or email or login via a remote IDP (eg. Google); instead they will see the dex type interstitial that says something like “Such and such app wants to do stuff on your behalf” and they just have to click a button and they will be redirected to the client callback URL with the auth code.

This is still one click too many however. So, when logging in (or registering), dex will add a special claim (something like “known_clients”) that contains the clientID of the oidc client (eg. Creme). When authenticating for these clients, dex will authenticate immediately and send them over to the client callback URL.

refresh tokens

Issue by sym3tri
Thursday Jul 02, 2015 at 21:43 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/295


For better security we should transition to having shorter-lived JWTs and instead issue refresh tokens to client apps so they can refresh the user's token on their behalf. Adding such a feature would require the ability for a user to revoke access to an app as well.

Users with unverified emails are never cleaned up

Issue by sym3tri
Monday Aug 03, 2015 at 23:21 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/352


Consider this case:

  1. Some joker named Mr. Bar tries to register with [email protected]. He is not the rightful owner of the email address so he can't verify it. Mr. Foo (the rightful owner of [email protected]) ignores the email.

  2. Some time later Mr. Foo tries to register with [email protected], but cannot register b/c that email is already registered. The email will stay in the unregistered state forever. Mr. Foo is sad b/c he cannot register.

Currently there is a workaround which Mr. Foo may not know about:

  1. click "login" instead of "register"
  2. click "forgot password"
  3. send reset password link
  4. click link & reset password
  5. hopefully the client app prompts him to verify his email before continuing, if not his email will never be verified.

Deploy using TLS unless `--no-tls` flag is set

Issue by bcwaldon
Tuesday Nov 11, 2014 at 21:16 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/26


TLS is absolutely necessary to protect the transmission of client secrets. However, there are two primary use-cases for not deploying authd with TLS:

  1. development - it can be a pain to deploy services with TLS in dev environments
  2. load-balancer - it is common to terminate SSL/TLS at a load balancer

Together, these use-cases add an interesting requirement: the ability to advertise HTTP vs HTTPS in the ProviderConfig. If TLS is completely off (the development use-case), then the ProviderConfig should advertise its endpoints using HTTP. If TLS is in use between clients and the load balancer, the ProviderConfig should still advertise HTTPS, but authd actually has nothing to do with TLS.

reset-password: valid email address but no password for userID

Issue by ecnahc515
Tuesday Jul 21, 2015 at 00:11 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/328


So I tried going through the reset password flow using my google accounts email address and got the following error in the authd logs:

ERROR: No Password for userID: "55f79aa1-33dc-4d53-b0e4-0406c9eaab85"

It currently tells me it sent an email to my registered email address, but it's not actually sending any emails. After reading https://github.com/coreos-inc/auth/issues/316 it should most likely show the same message regardless, but it should probably send an email with details stating that password resets are handled by the OIDC provider (such as google in this case), with possible instructions on how to reset passwords through the provider.

consider storing optional client identity meta data

Issue by sym3tri
Thursday Dec 11, 2014 at 18:41 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/146


There are many more OPTIONAL fields beyond just id and secret. For instance name and contacts seem like good ones for us to consider given that we'll provide a listing of all registered clients in the admin UI and client ids are not very user-friendly.

http://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata

implicit grants

Issue by sym3tri
Thursday Dec 04, 2014 at 23:46 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/128


The spec requires us to support it. We need to do so or document that we intentionally diverge from the spec.

grant_types_supported
OPTIONAL. JSON array containing a list of the OAuth 2.0 Grant Type values that this OP supports. Dynamic OpenID Providers MUST support the authorization_code and implicit Grant Type values and MAY support other Grant Types. If omitted, the default value is ["authorization_code", "implicit"].

http://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.