feat: block webauthn credential authentication from non-configured domains
This commit is contained in:
parent
f5540a4c12
commit
1a32229466
3 changed files with 68 additions and 8 deletions
|
|
@ -16,11 +16,13 @@ import { ReactComponent as WhiteLockIcon } from 'src/styling/icons/button/lock/w
|
||||||
import { ReactComponent as LockIcon } from 'src/styling/icons/button/lock/zodiac.svg'
|
import { ReactComponent as LockIcon } from 'src/styling/icons/button/lock/zodiac.svg'
|
||||||
import { ReactComponent as WhiteUserRoleIcon } from 'src/styling/icons/button/user-role/white.svg'
|
import { ReactComponent as WhiteUserRoleIcon } from 'src/styling/icons/button/user-role/white.svg'
|
||||||
import { ReactComponent as UserRoleIcon } from 'src/styling/icons/button/user-role/zodiac.svg'
|
import { ReactComponent as UserRoleIcon } from 'src/styling/icons/button/user-role/zodiac.svg'
|
||||||
|
import { IP_CHECK_REGEX } from 'src/utils/constants'
|
||||||
|
|
||||||
import styles from './UserManagement.styles'
|
import styles from './UserManagement.styles'
|
||||||
import ChangeRoleModal from './modals/ChangeRoleModal'
|
import ChangeRoleModal from './modals/ChangeRoleModal'
|
||||||
import CreateUserModal from './modals/CreateUserModal'
|
import CreateUserModal from './modals/CreateUserModal'
|
||||||
import EnableUserModal from './modals/EnableUserModal'
|
import EnableUserModal from './modals/EnableUserModal'
|
||||||
|
import FIDOModal from './modals/FIDOModal'
|
||||||
import Reset2FAModal from './modals/Reset2FAModal'
|
import Reset2FAModal from './modals/Reset2FAModal'
|
||||||
import ResetPasswordModal from './modals/ResetPasswordModal'
|
import ResetPasswordModal from './modals/ResetPasswordModal'
|
||||||
|
|
||||||
|
|
@ -194,13 +196,20 @@ const Users = () => {
|
||||||
InverseIcon={WhiteUserRoleIcon}
|
InverseIcon={WhiteUserRoleIcon}
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setUserInfo(u)
|
if (IP_CHECK_REGEX.test(window.location.hostname)) {
|
||||||
generateAttestationOptions({
|
dispatch({
|
||||||
variables: {
|
type: 'open',
|
||||||
userID: u.id,
|
payload: 'showFIDOModal'
|
||||||
domain: window.location.hostname
|
})
|
||||||
}
|
} else {
|
||||||
})
|
setUserInfo(u)
|
||||||
|
generateAttestationOptions({
|
||||||
|
variables: {
|
||||||
|
userID: u.id,
|
||||||
|
domain: window.location.hostname
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}}>
|
}}>
|
||||||
Add FIDO
|
Add FIDO
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
|
|
@ -276,6 +285,7 @@ const Users = () => {
|
||||||
user={userInfo}
|
user={userInfo}
|
||||||
requiresConfirmation={userInfo?.role === 'superuser'}
|
requiresConfirmation={userInfo?.role === 'superuser'}
|
||||||
/>
|
/>
|
||||||
|
<FIDOModal state={state} dispatch={dispatch} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
import Modal from 'src/components/Modal'
|
||||||
|
import { Button } from 'src/components/buttons'
|
||||||
|
import { Info2, P } from 'src/components/typography'
|
||||||
|
|
||||||
|
import styles from '../UserManagement.styles'
|
||||||
|
|
||||||
|
const useStyles = makeStyles(styles)
|
||||||
|
|
||||||
|
const ChangeRoleModal = ({ state, dispatch }) => {
|
||||||
|
const classes = useStyles()
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
dispatch({
|
||||||
|
type: 'close',
|
||||||
|
payload: 'showFIDOModal'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
closeOnBackdropClick={true}
|
||||||
|
width={450}
|
||||||
|
height={275}
|
||||||
|
handleClose={handleClose}
|
||||||
|
open={state.showFIDOModal}>
|
||||||
|
<Info2 className={classes.modalTitle}>About FIDO authentication</Info2>
|
||||||
|
<P className={classes.info}>
|
||||||
|
This feature is only available for websites with configured domains, and
|
||||||
|
we detected that a domain is not configured at the moment.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Make sure that a domain is configured for this website and try again
|
||||||
|
later.
|
||||||
|
</P>
|
||||||
|
<div className={classes.footer}>
|
||||||
|
<Button className={classes.submit} onClick={() => handleClose()}>
|
||||||
|
Confirm
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ChangeRoleModal
|
||||||
|
|
@ -6,11 +6,14 @@ const WALLET_SCORING_DEFAULT_THRESHOLD = 9
|
||||||
const AUTOMATIC = 'automatic'
|
const AUTOMATIC = 'automatic'
|
||||||
const MANUAL = 'manual'
|
const MANUAL = 'manual'
|
||||||
|
|
||||||
|
const IP_CHECK_REGEX = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
|
||||||
|
|
||||||
export {
|
export {
|
||||||
CURRENCY_MAX,
|
CURRENCY_MAX,
|
||||||
MIN_NUMBER_OF_CASSETTES,
|
MIN_NUMBER_OF_CASSETTES,
|
||||||
MAX_NUMBER_OF_CASSETTES,
|
MAX_NUMBER_OF_CASSETTES,
|
||||||
AUTOMATIC,
|
AUTOMATIC,
|
||||||
MANUAL,
|
MANUAL,
|
||||||
WALLET_SCORING_DEFAULT_THRESHOLD
|
WALLET_SCORING_DEFAULT_THRESHOLD,
|
||||||
|
IP_CHECK_REGEX
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue