Class NeoClientConfigResolver

java.lang.Object
org.operaton.bpm.spring.boot.starter.webapp.neo.NeoClientConfigResolver

public class NeoClientConfigResolver extends Object
Resolves the NeoClientConfig served to the SPA.

The authentication mode defaults to NeoWebappProperty.AUTH_MODE_AUTO, which means: use OAuth2 when the application has Spring Security OAuth2 client registrations configured, and basic authentication otherwise. So a user who integrates an identity provider gets SSO without touching a second switch, and everyone else gets a username and password form.

Client registrations are read straight from the Environment rather than from a ClientRegistrationRepository bean, so that this module needs no dependency on Spring Security — it is optional on the classpath. This mirrors ClientsNotConfiguredCondition in the security starter.

Since:
2.2
  • Field Details

  • Constructor Details

    • NeoClientConfigResolver

      public NeoClientConfigResolver(OperatonBpmProperties properties, org.springframework.core.env.Environment environment)
  • Method Details

    • resolve

      public NeoClientConfig resolve(String contextPath, Principal principal)
      Parameters:
      contextPath - the servlet context path, so the login and logout targets stay correct when the application is not deployed at the root
      principal - the authenticated principal, or null when there is no session
    • resolveAuthMode

      protected String resolveAuthMode(NeoWebappProperty neo)
    • resolveOAuth

      protected NeoClientConfig.OAuth resolveOAuth(String contextPath)
    • resolveUser

      protected NeoClientConfig.User resolveUser(Principal principal)
    • firstClientRegistrationId

      protected Optional<String> firstClientRegistrationId()
      The id of the first configured OAuth2 client registration, empty when none are configured. With several registrations the SPA sends the user to the first one; pick explicitly by setting operaton.bpm.webapp.neo.auth-mode and letting Spring Security's login page do the choosing.