Skip to content

Commit

Permalink
Merge pull request #2826 from bodnia/fix-2774
Browse files Browse the repository at this point in the history
#2774 display scopes for oauth2 password flow
  • Loading branch information
bodnia committed Mar 30, 2017
2 parents b34e363 + 432cd7f commit 1df4df6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dist/swagger-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/swagger-ui.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/core/components/auth/oauth2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ export default class Oauth2 extends React.Component {
static propTypes = {
name: PropTypes.string,
authorized: PropTypes.object,
configs: PropTypes.object,
getComponent: PropTypes.func.isRequired,
schema: PropTypes.object.isRequired,
authSelectors: PropTypes.object.isRequired,
authActions: PropTypes.object.isRequired,
errSelectors: PropTypes.object.isRequired,
errActions: PropTypes.object.isRequired,
getConfigs: PropTypes.function
getConfigs: PropTypes.any
}

constructor(props, context) {
Expand Down Expand Up @@ -173,7 +172,7 @@ export default class Oauth2 extends React.Component {
}

{
!isAuthorized && flow !== PASSWORD && scopes && scopes.size ? <div className="scopes">
!isAuthorized && scopes && scopes.size ? <div className="scopes">
<h2>Scopes:</h2>
{ scopes.map((description, name) => {
return (
Expand Down
5 changes: 4 additions & 1 deletion src/core/plugins/auth/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const PRE_AUTHORIZE_OAUTH2 = "pre_authorize_oauth2"
export const AUTHORIZE_OAUTH2 = "authorize_oauth2"
export const VALIDATE = "validate"

const scopeSeparator = " "

export function showDefinitions(payload) {
return {
type: SHOW_AUTH_POPUP,
Expand Down Expand Up @@ -77,7 +79,8 @@ export const authorizePassword = ( auth ) => ( { fn, authActions, errActions } )
query: {
grant_type: "password",
username,
password
password,
scopes: encodeURIComponent(auth.scopes.join(scopeSeparator))
}
}

Expand Down

0 comments on commit 1df4df6

Please sign in to comment.