public void setAuthnMethodEnabled(String deploymentName, String methodName, boolean enabled) { AuthnMethod method = getAuthnMethod(deploymentName, methodName); method.setEnabled(enabled); setAuthnMethod(deploymentName, method); }
public void setAuthnMethodEnabled(String deploymentName, String methodName, boolean enabled) { AuthnMethod method = getAuthnMethod(deploymentName, methodName); method.setEnabled(enabled); setAuthnMethod(deploymentName, method); }
public AuthnMethod getAuthnMethod(String deploymentName, String methodName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setSecurity().setAuthnMethod(methodName); return lookupService.getSingularNodeOrDefault(filter, AuthnMethod.class, () -> { try { return AuthnMethod.translateAuthnMethodName(methodName).newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } }, n -> setAuthnMethod(deploymentName, n)); }
public AuthnMethod getAuthnMethod(String deploymentName, String methodName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setSecurity().setAuthnMethod(methodName); return lookupService.getSingularNodeOrDefault(filter, AuthnMethod.class, () -> { try { return AuthnMethod.translateAuthnMethodName(methodName).newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } }, n -> setAuthnMethod(deploymentName, n)); }
@RequestMapping(value = "/authn/{methodName:.+}", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setAuthnMethod(@PathVariable String deploymentName, @PathVariable String methodName, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawMethod) { AuthnMethod method = objectMapper.convertValue( rawMethod, AuthnMethod.translateAuthnMethodName(methodName) ); return GenericUpdateRequest.<AuthnMethod>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(m -> securityService.setAuthnMethod(deploymentName, m)) .validator(() -> securityService.validateAuthnMethod(deploymentName, methodName)) .description("Edit " + methodName + " authentication settings") .build() .execute(validationSettings, method); }