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 void setAuthnMethodEnabled(String deploymentName, String methodName, boolean enabled) { AuthnMethod method = getAuthnMethod(deploymentName, methodName); method.setEnabled(enabled); setAuthnMethod(deploymentName, method); }
public void setAuthnMethod(String deploymentName, AuthnMethod method) { Authn authn = getAuthn(deploymentName); switch (method.getMethod()) { case OAuth2: authn.setOauth2((OAuth2) method); break; case SAML: authn.setSaml((Saml) method); break; case LDAP: authn.setLdap((Ldap) method); break; case X509: authn.setX509((X509) method); break; case IAP: authn.setIap((IAP) method); break; default: throw new RuntimeException("Unknown Authn method " + method.getMethod()); } }
public void setAuthnMethod(String deploymentName, AuthnMethod method) { Authn authn = getAuthn(deploymentName); switch (method.getMethod()) { case OAuth2: authn.setOauth2((OAuth2) method); break; case SAML: authn.setSaml((Saml) method); break; case LDAP: authn.setLdap((Ldap) method); break; case X509: authn.setX509((X509) method); break; case IAP: authn.setIap((IAP) method); break; default: throw new RuntimeException("Unknown Authn method " + method.getMethod()); } }
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 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); }