Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Keystone connector#1374

Merged
srenatus merged 4 commits into
dexidp:masterfrom
kbalka:keystone-connector
Jan 11, 2019
Merged

Keystone connector#1374
srenatus merged 4 commits into
dexidp:masterfrom
kbalka:keystone-connector

Conversation

@kbalka
Copy link
Copy Markdown
Contributor

@kbalka kbalka commented Dec 14, 2018

PR contains connector for openstack keystone.

Features:

  • access tokens
  • refresh tokens
  • groups

Requirements:

  • access to openstack keystone instance
  • keystone administrative account credentials

Enabling keystone connector specific tests:

  • make sure docker is running
  • export DEX_TEST_KEYSTONE=1
  • make tests

Copy link
Copy Markdown

@soggiest soggiest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There looks to be incorrect tabbing in keystone.go and keystone_test.go. Please make sure the tab formatting is consistent, otherwise it is difficult to read the code.

logrus is imported but not used. Please change the fmt.Printf lines to use logrus to ensure consistency with the rest of Dex.

Copy link
Copy Markdown
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 🎈 🎉 Thank you for working on this 👍

(I'm assuming @knangia is on board with this. 👋)

A round of comments inline; adding to what @soggiest already raised.

A general point -- the way this connector interacts with docker seems new compared to the other test suites. It's dragging in new dependencies (and these aren't vendored, so tests fail). I wonder if we could rather add a docker run -d call to .travis.yml, like we do for etcd? This would let us avoid managing the keystone container from TestMain. (Furthermore, we could then simplify the tests a little, taking in DEX_KEYSTONE_URL and DEX_KEYSTONE_ADMIN_URL, or something like that, and calling t.Skip() if they're not set.)

Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/types.go Outdated
Comment thread connector/keystone/types.go Outdated
Comment thread examples/config-keystone.yaml Outdated
Comment thread connector/keystone/keystone_test.go Outdated
Comment thread connector/keystone/keystone_test.go Outdated
@kbalka
Copy link
Copy Markdown
Contributor Author

kbalka commented Dec 17, 2018

Hi @srenatus, @soggiest, thanks for fast review. We will provide bunch of updates soon. To my best knowledge, @knangia is the loop.

Copy link
Copy Markdown
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking on the previous batch of comments. I gave this another thorough read, please bear with me on the changes.

😃 I like how this is taking shape, and it'll be a nice addition. 🎉

I'm also curious about your use case. How do you plan to use dex-with-keystone? Which applications will likely leverage your openstack cluster's authentication? 😃

Comment thread .travis.yml Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ I really don't know, so, this is not a leading question: What's the advantage of --net=host vs -p 0.0.0.0:5000:5000?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question :-) For me, the advantage here is only readability - you can see which ports are exposed and compare it with exported variables DEX_KEYSTONE*.

Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/types.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like some of these are not used? (Like the IssuedAt and ExpiresAt fields, but maybe more) -- Can we remove them or add a comment?

Also, do we need to care about the ExpiresAt for this connector's functionality? (I can't oversee that right now 😅 )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to care about ExpiresAt - because we are using token immediately after it's obtained. Keystone tokens are quite short living (I think by default 1h). Keeping it in identity.ConnectorData and using for Refresh would limit liveness of dex refresh token by expiration of keystone user token. That's why we require keystone admin account credentials. Admin should have access to other's users and their groups. When we check refresh token, the admin account gets fresh token from keystone and verifies user existence and groups. I hope that it makes some sense :-)

Comment thread connector/keystone/keystone_test.go Outdated
Comment thread .travis.yml Outdated
Comment thread .travis.yml Outdated
Comment thread connector/keystone/keystone.go Outdated
@srenatus
Copy link
Copy Markdown
Contributor

🎗 Note to self: let's squash these before merging.

@srenatus
Copy link
Copy Markdown
Contributor

Not right now, though! I appreciate the separate commits a lot for review 👍

@joannanosek
Copy link
Copy Markdown
Contributor

Hi @srenatus! Sorry for torpedoing with the commits 😅 And thank you for valuable feedback!

@kbalka
Copy link
Copy Markdown
Contributor Author

kbalka commented Dec 19, 2018

the application which can possibly leverage openstack cluster authentication is https://github.com/IntelAI/inference-model-manager :-)

Comment thread connector/keystone/types.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this token be cached?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add caching token across sessions if needed, but my opinion is that at this moment we should keep the code simple. Is it ok for you ?

Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: keep these arguments on one line

Comment thread connector/keystone/types.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already in the keystone package, so this can just be called "connector"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After moving this struct to keystone.go, name connector clashes with import "github.com/dexidp/dex/connector" , but I'm open to suggestions how to rename it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about conn or plain c? Currently, other connectors use a similar name to what's introduced here (e.g. microsoftConnector), but I do agree that shorter is nicer, the context is clear here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it makes sense. I've changed to conn.

Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/keystone.go Outdated
Comment thread connector/keystone/types.go Outdated
Comment thread connector/keystone/types.go Outdated
Copy link
Copy Markdown
Contributor

@ericchiang ericchiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of little comments but thanks for the tests. Overall this looks like something we should merge.

Whenever you use a keystone endpoint, please add a comment including a link to the upstream docs for that endpoint. It helps others maintain and review :)

@kbalka
Copy link
Copy Markdown
Contributor Author

kbalka commented Dec 21, 2018

Hi @ericchiang, thanks for a thorough review. I'd addressed most of the issues. Please check if it looks better now. Regarding use of openio/openstack-keystone:latest image, I've asked the maintainer to add specific version tag, waiting for response. But, the most important, merry 🎄 and 🎅 to you together with @joannanosek @srenatus and @soggiest !

@soggiest
Copy link
Copy Markdown

soggiest commented Dec 21, 2018 via email

@ericchiang
Copy link
Copy Markdown
Contributor

FYI, I'm on vacation and won't be able to look at this until late next week. I promise I'm not just procrastinating :)

@srenatus srenatus mentioned this pull request Jan 9, 2019
Copy link
Copy Markdown
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. (⏳ waiting for @ericchiang's approval, too.)

@srenatus
Copy link
Copy Markdown
Contributor

OK I'd really like to get a release out soon. Looking at the reviews, I think this is good to go.

Follow-up work can happen in another PR, this is mergeable. (The only thing I see as a potential improvement is caching the admin token. I'll create an issue for that when this is merged.)

@kbalka would you mind squashing those commits? Let's do it in a way that preserves @knangia's and @joannanosek's contributions -- either by adding a Co-authored-by: annotation, or by squashing commits per-author. 😃

@kbalka kbalka force-pushed the keystone-connector branch from a45dbaa to 88473bc Compare January 11, 2019 12:24
@kbalka
Copy link
Copy Markdown
Contributor Author

kbalka commented Jan 11, 2019

Hi @srenatus. Thanks for the approval !!! I've squashed the commits into number of 4, added authors and force-pushed the branch on my fork. The code seems to be ready for merge. The only strange thing I can observe that there is a "tail" of 8 commits in the PR which are already on the master. They will probably disappear after merge, but I'm not sure. I can fix the PR if needed.

@srenatus
Copy link
Copy Markdown
Contributor

srenatus commented Jan 11, 2019 via email

@kbalka kbalka force-pushed the keystone-connector branch from 88473bc to e8ba848 Compare January 11, 2019 14:16
@kbalka
Copy link
Copy Markdown
Contributor Author

kbalka commented Jan 11, 2019

@srenatus I've rebased to the master. looks like we are ready to hit the button :)

@srenatus
Copy link
Copy Markdown
Contributor

@kbalka Thank you so much! 🎉

@ericchiang sorry I didn't wait for your "👍" after all. Feel free to assign me anything that's left 😉

@srenatus srenatus merged commit f1581ff into dexidp:master Jan 11, 2019
mmrath pushed a commit to mmrath/dex that referenced this pull request Sep 2, 2019
PR contains connector for openstack keystone.

Features:

    access tokens
    refresh tokens
    groups

Requirements:

    access to openstack keystone instance
    keystone administrative account credentials

Enabling keystone connector specific tests:

    make sure docker is running
    export DEX_TEST_KEYSTONE=1
    make tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants