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

api: adding a gRPC call for revoking refresh tokens. #802

Merged
merged 1 commit into from Feb 15, 2017

Conversation

rithujohn191
Copy link
Contributor

@rithujohn191 rithujohn191 commented Feb 14, 2017

Added a gRPC call that will enable users to revoke client specific refresh tokens.

Also added a test in api_test.go. Since we do not have APIs in place for creating refresh tokens and offline session objects, this has been done using the storage methods. If this test case seems like an overkill, I could get rid of it.

@rithujohn191 rithujohn191 force-pushed the token-revocation branch 2 times, most recently from c786e4b to cf6232d Compare February 14, 2017 23:07
server/api.go Outdated
return nil, err
}

offlineSessions, err := d.s.GetOfflineSessions(id.UserId, id.ConnId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't this done in an Update?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed this to an update operation

server/api.go Outdated

// If the user has no more refresh tokens, the OfflineSession object should be cleaned up.
if len(offlineSessions.Refresh) == 0 {
if err := d.s.DeleteOfflineSessions(id.UserId, id.ConnId); err != nil {
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 just keep this object around? Why delete it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline and decided to keep the Offline Session object around even if the user does not have active refresh tokens. Might be helpful later on for auditing purposes.

@ericchiang
Copy link
Contributor

thanks for the test. couple nits

// RevokeRefreshResp determines if the refresh token is revoked successfully.
message RevokeRefreshResp {
// Set to true is refresh token was not found and token could not be revoked.
bool not_found = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

this is never set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Set this to true when UpdateOfflineSession returns err == storage.ErrNotFound.

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

lgtm

@rithujohn191 rithujohn191 merged commit 7e9dc83 into dexidp:master Feb 15, 2017
@rithujohn191 rithujohn191 deleted the token-revocation branch February 15, 2017 16:44
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