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

ClientCredentials flow in basic User operations (createUser, getUser, resendInvitationMail) #529

Merged
merged 1 commit into from Sep 1, 2016

Conversation

adrianlop
Copy link
Contributor

Fixes #528

@adrianlop adrianlop force-pushed the Clients_create_users branch 3 times, most recently from ec35029 to f463135 Compare August 2, 2016 20:21
@@ -92,7 +94,7 @@ func (s *UserMgmtServer) authAPIHandle(handle authedHandle, requiresAdmin bool)
s.writeError(w, err)
return
}
if creds.User.Disabled || (requiresAdmin && !creds.User.Admin) {
if creds.User.ID != "" && (creds.User.Disabled || (requiresAdmin && !creds.User.Admin)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

creds.User.ID != "" shouldn't be checked here. There should be two paths for this code.

if clientcred {

} else {

}

@adrianlop
Copy link
Contributor Author

PR updated. The flag is a hard choice now, it forces you to create users only using client credentials token, if enabled.

@adrianlop adrianlop changed the title ClientCredentials flow in CreateUser ClientCredentials flow in basic User operations (createUser, getUser, resendInvitationMail) Aug 24, 2016
@adrianlop
Copy link
Contributor Author

updated PR. now it supports createUser, getUser, resendInvitationMail, not only createUser.

@@ -51,6 +51,9 @@ func main() {

enableClientRegistration := fs.Bool("enable-client-registration", false, "Allow dynamic registration of clients")

// Client credentials administration
forceClientUserCreation := fs.Bool("force-client-user-creation", false, "force create users using admin client-credentials")
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't just about client creation, it's about the entire layer of API access.

Let's do --api-use-client-credentials

@adrianlop
Copy link
Contributor Author

thanks, PR updated with your comments.

@@ -51,6 +51,9 @@ func main() {

enableClientRegistration := fs.Bool("enable-client-registration", false, "Allow dynamic registration of clients")

// Client credentials administration
apiUseClientCredentials := fs.Bool("api-use-client-credentials", false, "Forces API to authenticate using client credentials instead of an ID token.Clients must be 'admin clients' to use the API.")
Copy link
Contributor

Choose a reason for hiding this comment

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

s/token.Clients/token. Clients/g

@ericchiang
Copy link
Contributor

this looks good to me, but requires fixing the spelling mistakes in the command line flag and adding some unit/integration tests.

@adrianlop
Copy link
Contributor Author

ok! I'm working on the tests, will update the PR when ready.

@adrianlop
Copy link
Contributor Author

PR updated with tests!

@@ -869,7 +988,7 @@ func (t *testEmailer) SendInviteEmail(email string, redirectURL url.URL, clientI
return retURL, nil
}

func makeUserToken(issuerURL url.URL, userID, clientID string, expires time.Duration, privKey *key.PrivateKey) string {
func makeToken(issuerURL url.URL, userID, clientID string, expires time.Duration, privKey *key.PrivateKey) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

in the future please don't include changes that aren't relevant to the pr.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah my bad, I see why you did this. perhaps create a different method that doesn't take a clientID instead?

@ericchiang
Copy link
Contributor

two more nits, sorry.

@adrianlop
Copy link
Contributor Author

sure no prob, PR updated with your comments.

@ericchiang
Copy link
Contributor

lgtm!

@ericchiang ericchiang merged commit d758e38 into dexidp:master Sep 1, 2016
@gerson24 gerson24 deleted the Clients_create_users branch September 2, 2016 06:47
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.

None yet

2 participants