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

Defining a User #54

Open
darkcrux opened this issue May 25, 2016 · 6 comments
Open

Defining a User #54

darkcrux opened this issue May 25, 2016 · 6 comments
Assignees

Comments

@darkcrux
Copy link
Collaborator

Currently we're just supporting github and any user with proper github creds can create pipelines for repositories they have admin access to. There's barely a user profile.

When we start supporting other SCMs, a user profile might be useful. There might be a case when a user has repositories in both Github and BitBucket and wants to create pipelines for both.

A redesign of how the users are handled may be needed. Right now, if we support multiple SCMs, the user will have to relogin with the OAuth for github/bitbucket/etc to access their repositories. Might not be a good user experience.

@hunter
Copy link
Contributor

hunter commented May 25, 2016

I would imagine similar issues if there was no repo added and all tests were triggered from docker reg webhooks.

Might be worth looking closer at k8s users and the ThirdPartyResource?

@darkcrux
Copy link
Collaborator Author

An idea of a user profile might look like this:

kontinuous:
  users:
    - {uuid}
        - name: username, taken from sub of jwt or github/bitbucket ID?
          keys:
            github: _encrypted_github_key_
            bitbucket: _encrypted_bitbucket_key_

then an identities map to search for user profiles upon logging in:

kontinuous:
  identities:
    github:
      - {github_id}: {user_uuid}
    bitbucket:
      - {bitbucket_id}: {user_uuid}
    etc:
      - ???

the idea is that a user could have several identities (github, bitbucket, etc). the identities table maps the identity provided by github/bitbucket/auth0/etc to a user profile. This way we can have a user access their github & bitbucket repository as long as they link them to the profile.

we could have the ff login endpoints:

  • /login/github
  • /login/bitbucket
  • etc

For Auth0 and other providers, they can already return a JWT with identities given, so it's just a matter of creating the user profile and identity mapping.

Auth flow will be similar to what we have now with a minor addition:

[github/bitbucket/etc starts here]

  1. user redirects to github/bitbucket then sends auth code to /login/{github,bitbucket}
  2. kontinuous retrieves token from either github/bitbucket
  3. kontinuous creates JWT with github/bitbucket identities added

[auth0, etc starts here]

  1. with a valid JWT, kontinuous searches the identities for matching user profile
  2. if profile is not found: create the user profile and mapping in the identities
  3. update JWT with the user profile (without the keys), just the UUID
  4. return the JWT. A valid JWT should have the user profile UUID

@hunter
Copy link
Contributor

hunter commented May 27, 2016

Nice. I think my only initial comment is that rather than using uuid for user we use the same convention as ABAC with user

@hunter hunter added the ready label May 30, 2016
@darkcrux
Copy link
Collaborator Author

darkcrux commented Jun 3, 2016

related:

for web login via github, bitbucket, etc:

user-oauth-jwt mmd

for oidc login, eg. auth0:

user-oidc-jwt mmd

ps. mermaid-cli is sooo cool.

@darkcrux
Copy link
Collaborator Author

darkcrux commented Jun 3, 2016

a few things to note about user and authentication:

  1. need a way to add identities to an existing user (eg. user uses github login, a new user gets created with a github identity and able to access his github repositories. there should be a way to add bitbucket credentials to the existing user to be able to access bitbucket repositories, etc)
  2. support linking/merging of users? (eg. user uses github login, a new user is created. same user uses bitbucket login, a new user is also created. should there be a way to merge these two as a single user? or is it too complicated? should an email address be used to identify existing users?)

@darkcrux darkcrux added in progress and removed ready labels Jun 8, 2016
@darkcrux darkcrux self-assigned this Jun 8, 2016
@darkcrux
Copy link
Collaborator Author

darkcrux commented Jun 9, 2016

login auth and user now follow this pattern. it should be easier to add new login now (bitbucket)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants