2FA: allow MFA_CONFIGURATION_TOKEN for getting and submitting config
This commit is contained in:
parent
942f909260
commit
9ca4ff92f6
@ -66,7 +66,7 @@ public class TwoFactorAuthConfigController extends BaseController {
|
|||||||
" }\n}\n```" +
|
" }\n}\n```" +
|
||||||
ControllerConstants.AVAILABLE_FOR_ANY_AUTHORIZED_USER)
|
ControllerConstants.AVAILABLE_FOR_ANY_AUTHORIZED_USER)
|
||||||
@GetMapping("/account/settings")
|
@GetMapping("/account/settings")
|
||||||
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
|
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER', 'MFA_CONFIGURATION_TOKEN')")
|
||||||
public AccountTwoFaSettings getAccountTwoFaSettings() throws ThingsboardException {
|
public AccountTwoFaSettings getAccountTwoFaSettings() throws ThingsboardException {
|
||||||
SecurityUser user = getCurrentUser();
|
SecurityUser user = getCurrentUser();
|
||||||
return twoFaConfigManager.getAccountTwoFaSettings(user.getTenantId(), user).orElse(null);
|
return twoFaConfigManager.getAccountTwoFaSettings(user.getTenantId(), user).orElse(null);
|
||||||
@ -125,7 +125,7 @@ public class TwoFactorAuthConfigController extends BaseController {
|
|||||||
"or if the provider is not configured for usage. " +
|
"or if the provider is not configured for usage. " +
|
||||||
ControllerConstants.AVAILABLE_FOR_ANY_AUTHORIZED_USER)
|
ControllerConstants.AVAILABLE_FOR_ANY_AUTHORIZED_USER)
|
||||||
@PostMapping("/account/config/submit")
|
@PostMapping("/account/config/submit")
|
||||||
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
|
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER', 'MFA_CONFIGURATION_TOKEN')")
|
||||||
public void submitTwoFaAccountConfig(@Valid @RequestBody TwoFaAccountConfig accountConfig) throws Exception {
|
public void submitTwoFaAccountConfig(@Valid @RequestBody TwoFaAccountConfig accountConfig) throws Exception {
|
||||||
SecurityUser user = getCurrentUser();
|
SecurityUser user = getCurrentUser();
|
||||||
twoFactorAuthService.prepareVerificationCode(user, accountConfig, false);
|
twoFactorAuthService.prepareVerificationCode(user, accountConfig, false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user