public static Supplier<AuthnMethod> getAuthnMethod(String deploymentName, String methodName, boolean validate) { return () -> { Object rawOAuth2 = ResponseUnwrapper.get(getService().getAuthnMethod(deploymentName, methodName, validate)); return getObjectMapper().convertValue(rawOAuth2, AuthnMethod.translateAuthnMethodName(methodName)); }; }
public static Supplier<AuthnMethod> getAuthnMethod(String deploymentName, String methodName, boolean validate) { return () -> { Object rawOAuth2 = ResponseUnwrapper.get(getService().getAuthnMethod(deploymentName, methodName, validate)); return getObjectMapper().convertValue(rawOAuth2, AuthnMethod.translateAuthnMethodName(methodName)); }; }
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); }