-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56510 from dhartunian/backport20.2-55552
release-20.2: auth: add autoLogin ability to OIDC configuration
- Loading branch information
Showing
9 changed files
with
103 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2020 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
import React from "react"; | ||
|
||
import { LoginAPIState } from "oss/src/redux/login"; | ||
import { Button } from "src/components"; | ||
import { RouteComponentProps, withRouter } from "react-router-dom"; | ||
|
||
const OIDC_LOGIN_PATH = "/oidc/v1/login"; | ||
|
||
const OIDCLoginButton = ({loginState}: {loginState: LoginAPIState}) => { | ||
return ( | ||
<a href={OIDC_LOGIN_PATH} > | ||
<Button type="secondary" className="submit-button-oidc" disabled={loginState.inProgress} textAlign={"center"}> | ||
{loginState.oidcButtonText} | ||
</Button> | ||
</a> | ||
); | ||
}; | ||
|
||
const OIDCLogin: React.FC<{loginState: LoginAPIState} & RouteComponentProps> = (props) => { | ||
const oidcAutoLoginQuery = new URLSearchParams(props.location.search).get("oidc_auto_login"); | ||
if (props.loginState.oidcLoginEnabled) { | ||
if (props.loginState.oidcAutoLogin && !(oidcAutoLoginQuery === "false")) { | ||
window.location.replace(OIDC_LOGIN_PATH); | ||
} | ||
return <OIDCLoginButton loginState={props.loginState} />; | ||
} | ||
return null; | ||
}; | ||
|
||
export const OIDCLoginConnected = withRouter(OIDCLogin); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters