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

new connector for Atlassian Crowd #1515

Merged
merged 1 commit into from
Feb 24, 2020

Conversation

diafour
Copy link
Contributor

@diafour diafour commented Aug 9, 2019

New connector for Atlassian Crowd identity management server. This initial implementation uses PasswordConnector ans should support groups and refresh. But there is no tests yet and sso feature is not tested with Jira or Confluence. Is this looks interesting?

Copy link
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.

Took an initial pass, please bear with me! Thanks for the contribution, this is nice.

  • Could you please add a comment referring to some kind of API docs for this?
  • Let's please add tests -- it's difficult to have any integration-test-like stuff for this, but you can glance at the tests for github/gitlab -- there's still some meaningful unit tests possible, I believe.

}

// Open returns a strategy for logging in through Atlassian Crowd.
func (c *Config) Open(id string, logger log.Logger) (connector.Connector, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] if id isn't used, let's do this:

Suggested change
func (c *Config) Open(id string, logger log.Logger) (connector.Connector, error) {
func (c *Config) Open(_ string, logger log.Logger) (connector.Connector, error) {

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, fixed!

}

type connectorData struct {
// GitLab's OAuth2 tokens never expire. We don't need a refresh token.
Copy link
Contributor

Choose a reason for hiding this comment

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

...GitLab? 😉

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, connectorData is not used in the Crowd connector. I removed it.

return connector.Identity{}, false, nil
}

c.logger.Infof("crowd Login scopes: %+v", s)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this or change it to debug? I'm not sure I'd want to see this for every login using this connector 😄

Copy link
Member

Choose a reason for hiding this comment

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

Fixed.

IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Why do we need this? Does it differ from http.DefaultTransport?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

There is a difference with DefaultTransport in one field - ForceAttemptHTTP2.

func (c *crowdConnector) authenticateWithPassword(ctx context.Context, client *http.Client, username string, password string) (invalidPass bool, err error) {
req, err := c.crowdUserManagementRequest(ctx,
"POST",
fmt.Sprintf("/session"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Sprintf("/session"),
"/session",

Copy link
Member

Choose a reason for hiding this comment

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

Fixed.


var authError crowdAuthenticationError

c.logger.Infof("body: %s", string(body))
Copy link
Contributor

Choose a reason for hiding this comment

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

This can also go away I think.

Copy link
Member

Choose a reason for hiding this comment

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

I got rid of it.

// read operations of the /api/v4/user endpoint
scopeUser = "read_user"
// used to retrieve groups from /oauth/userinfo
// https://docs.gitlab.com/ee/integration/openid_connect_provider.html
Copy link
Contributor

Choose a reason for hiding this comment

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

gitlab? 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This plugin is based on gitlab plugin. Definitely code cleaning is required.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed.

scopeOpenID = "openid"
)

// Config holds configuration options for Atlassian Crowd conector.
Copy link
Contributor

@srenatus srenatus Sep 4, 2019

Choose a reason for hiding this comment

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

[typo]

Suggested change
// Config holds configuration options for Atlassian Crowd conector.
// Config holds configuration options for Atlassian Crowd connector.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed.

@nabokihms nabokihms force-pushed the atlassian-crowd-connector branch 3 times, most recently from 95a30cd to fbe878a Compare January 31, 2020 18:22
@nabokihms
Copy link
Member

@srenatus can you take a look at the PR again?

We run the Atlassian Crowd connector in production for a couple of months and everything seems fine!
For now, we:

  • Fixed all things you mentioned in this PR
  • Wrote the doc about Atlassian Crowd connector
  • Added unit tests
  • Added SVG icon and fixed CSS

If @srenatus is not available, maybe @bonifaido or @sagikazarmark can review this PR?

Thanks in advance!

@nabokihms nabokihms force-pushed the atlassian-crowd-connector branch from fbe878a to 7ef1179 Compare February 5, 2020 09:19
@mvdkleijn
Copy link
Contributor

Is there anything that still needs to be done for this apart from someone giving it a positive review?

@mvdkleijn
Copy link
Contributor

@srenatus @bonifaido @sagikazarmark - I just setup dex with this connector and it works beautifully! I don't suppose any of you can give it a review so it can be included in the official dex builds? :-)

Copy link
Member

@sagikazarmark sagikazarmark left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@bonifaido bonifaido left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@bonifaido bonifaido merged commit b7cf701 into dexidp:master Feb 24, 2020
@mvdkleijn
Copy link
Contributor

Yay! Thanks guys! 😄

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