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

connector: Connectors without a RefreshConnector should not error out #872

Merged
merged 1 commit into from
Mar 23, 2017

Conversation

rithujohn191
Copy link
Contributor

fixes #871.

Tested this change by running the example-app with okta. The "Creating SAML data: SAML does not support offline access" error is no longer displayed. The example app does not display a refresh token on the final out put page.

@rithujohn191 rithujohn191 force-pushed the offline-access-error branch 2 times, most recently from 2b5a21f to 4826fb3 Compare March 23, 2017 21:25
@@ -647,7 +647,15 @@ func (s *Server) handleAuthCode(w http.ResponseWriter, r *http.Request, client s

reqRefresh := func() bool {
for _, scope := range authCode.Scopes {
if scope == scopeOfflineAccess {
conn, ok := s.connectors[authCode.ConnectorID]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also this check needs to happen outside the for loop :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@rithujohn191 rithujohn191 force-pushed the offline-access-error branch 2 times, most recently from c6ee5fb to 10b1c1f Compare March 23, 2017 21:46
s.tokenErrHelper(w, errServerError, "", http.StatusInternalServerError)
return false
}
_, ok = conn.Connector.(connector.RefreshConnector)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can short circuit this.

if !ok {
    return false
}

This avoids the loop in some cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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 6146e23 into dexidp:master Mar 23, 2017
@rithujohn191 rithujohn191 deleted the offline-access-error branch March 23, 2017 23:11
mmrath pushed a commit to mmrath/dex that referenced this pull request Sep 2, 2019
connector: Connectors without a RefreshConnector should not error out
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.

Connectors that don't support refresh tokens shouldn't return one instead of erroring
2 participants