mirror of
https://github.com/minio/minio.git
synced 2025-04-11 23:12:12 -04:00
parent
8fb37a8417
commit
852fb320f7
@ -148,7 +148,8 @@ export class Login extends React.Component {
|
|||||||
<OpenIDLoginButton
|
<OpenIDLoginButton
|
||||||
className="btn openid-btn"
|
className="btn openid-btn"
|
||||||
clientId={this.state.clientId}
|
clientId={this.state.clientId}
|
||||||
authorizationEndpoint={this.state.discoveryDoc.authorization_endpoint}
|
authEp={this.state.discoveryDoc.authorization_endpoint}
|
||||||
|
authScopes={this.state.discoveryDoc.scopes_supported}
|
||||||
>
|
>
|
||||||
Log in with OpenID
|
Log in with OpenID
|
||||||
</OpenIDLoginButton>
|
</OpenIDLoginButton>
|
||||||
|
@ -66,6 +66,7 @@ export class OpenIDLogin extends React.Component {
|
|||||||
|
|
||||||
const authURL = buildOpenIDAuthURL(
|
const authURL = buildOpenIDAuthURL(
|
||||||
this.state.discoveryDoc.authorization_endpoint,
|
this.state.discoveryDoc.authorization_endpoint,
|
||||||
|
this.state.discoveryDoc.scopes_supported,
|
||||||
redirectURI,
|
redirectURI,
|
||||||
this.state.clientID,
|
this.state.clientID,
|
||||||
nonce
|
nonce
|
||||||
|
@ -27,7 +27,7 @@ export class OpenIDLoginButton extends React.Component {
|
|||||||
|
|
||||||
handleClick(event) {
|
handleClick(event) {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
const { authorizationEndpoint, clientId } = this.props
|
const { authEp, authScopes, clientId } = this.props
|
||||||
|
|
||||||
let redirectURI = window.location.href.split("#")[0]
|
let redirectURI = window.location.href.split("#")[0]
|
||||||
if (redirectURI.endsWith('/')) {
|
if (redirectURI.endsWith('/')) {
|
||||||
@ -40,7 +40,7 @@ export class OpenIDLoginButton extends React.Component {
|
|||||||
const nonce = getRandomString(16)
|
const nonce = getRandomString(16)
|
||||||
storage.setItem(OPEN_ID_NONCE_KEY, nonce)
|
storage.setItem(OPEN_ID_NONCE_KEY, nonce)
|
||||||
|
|
||||||
const authURL = buildOpenIDAuthURL(authorizationEndpoint, redirectURI, clientId, nonce)
|
const authURL = buildOpenIDAuthURL(authEp, authScopes, redirectURI, clientId, nonce)
|
||||||
window.location = authURL
|
window.location = authURL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,14 +16,13 @@
|
|||||||
|
|
||||||
export const OPEN_ID_NONCE_KEY = 'openIDKey'
|
export const OPEN_ID_NONCE_KEY = 'openIDKey'
|
||||||
|
|
||||||
export const buildOpenIDAuthURL = (authorizationEndpoint, redirectURI, clientID, nonce) => {
|
export const buildOpenIDAuthURL = (authEp, authScopes, redirectURI, clientID, nonce) => {
|
||||||
const params = new URLSearchParams()
|
const params = new URLSearchParams()
|
||||||
params.set("response_type", "id_token")
|
params.set("response_type", "id_token")
|
||||||
params.set("scope", "openid")
|
params.set("scope", authScopes.join(" "))
|
||||||
params.set("client_id", clientID)
|
params.set("client_id", clientID)
|
||||||
params.set("redirect_uri", redirectURI)
|
params.set("redirect_uri", redirectURI)
|
||||||
params.set("nonce", nonce)
|
params.set("nonce", nonce)
|
||||||
|
|
||||||
return `${authorizationEndpoint}?${params.toString()}`
|
return `${authEp}?${params.toString()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -157,7 +157,7 @@ func main() {
|
|||||||
TokenURL: ddoc.TokenEndpoint,
|
TokenURL: ddoc.TokenEndpoint,
|
||||||
},
|
},
|
||||||
RedirectURL: fmt.Sprintf("http://localhost:%d/oauth2/callback", port),
|
RedirectURL: fmt.Sprintf("http://localhost:%d/oauth2/callback", port),
|
||||||
Scopes: []string{"openid"},
|
Scopes: ddoc.ScopesSupported,
|
||||||
}
|
}
|
||||||
|
|
||||||
state := randomState()
|
state := randomState()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user