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
Allow OIDC as default login #3617
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,6 +10,8 @@ import {Error} from "../../lib/components/controls" | |||||||||||||||||||||||||||||
import {useRouter} from "../../lib/hooks/router"; | ||||||||||||||||||||||||||||||
import {useAPI} from "../../lib/hooks/api"; | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
const OIDC_LOGIN_URL = "/oidc/login?prompt=login"; | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
const LoginForm = ({oidcEnabled}) => { | ||||||||||||||||||||||||||||||
const router = useRouter(); | ||||||||||||||||||||||||||||||
const [loginError, setLoginError] = useState(null); | ||||||||||||||||||||||||||||||
|
@@ -60,7 +62,7 @@ const LoginForm = ({oidcEnabled}) => { | |||||||||||||||||||||||||||||
<Button variant="link" className="text-secondary mt-2" onClick={async ()=> { | ||||||||||||||||||||||||||||||
document.cookie = 'oidc_auth_session=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; | ||||||||||||||||||||||||||||||
document.cookie = 'internal_auth_session=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; | ||||||||||||||||||||||||||||||
window.location = "/oidc/login?prompt=login"; | ||||||||||||||||||||||||||||||
window.location = OIDC_LOGIN_URL; | ||||||||||||||||||||||||||||||
}}>Sign in with SSO provider</Button> | ||||||||||||||||||||||||||||||
: "" | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
|
@@ -82,6 +84,9 @@ const LoginPage = () => { | |||||||||||||||||||||||||||||
if (!error && response && response.state !== SETUP_STATE_INITIALIZED) { | ||||||||||||||||||||||||||||||
router.push({pathname: '/setup', query: router.query}) | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
if (!error && response && response.oidc_default_login) { | ||||||||||||||||||||||||||||||
window.location = OIDC_LOGIN_URL; | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic here is a bit worrying: it seems like a both What makes it even more confusing is that when I think something like this might be easier (if it is indeed correct, of course!):
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||||||||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||||||||
<Layout logged={false}> | ||||||||||||||||||||||||||||||
<LoginForm oidcEnabled={!error && response && response.oidc_enabled }/> | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great way to add a property! I even complained about the added line on
swagger.yml
(then had to delete that comment when I saw this documentation...).