Class SocialProvidersCondition

java.lang.Object
com.irurueta.authserver.authorization.api.web.social.SocialProvidersCondition
All Implemented Interfaces:
org.springframework.context.annotation.Condition

public class SocialProvidersCondition extends Object implements org.springframework.context.annotation.Condition
Condition that holds when at least one social provider is configured, that is, when some authserver.social.providers.<id>.client-id has text. Every bean of the social login hangs from it, so with no provider configured (the default) the application has no social login at all: no client registration repository (which cannot be empty), no filter and no login page entry.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static boolean
    isConfigured(org.springframework.core.env.Environment environment, IdentityProvider provider)
    Tells whether a provider is configured.
    boolean
    matches(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata)
    Tells whether any provider is configured.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SocialProvidersCondition

      public SocialProvidersCondition()
  • Method Details

    • isConfigured

      static boolean isConfigured(org.springframework.core.env.Environment environment, IdentityProvider provider)
      Tells whether a provider is configured.
      Parameters:
      environment - environment to read the setting from.
      provider - the provider.
      Returns:
      true when the provider's client id has text.
    • matches

      public boolean matches(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata)
      Tells whether any provider is configured.
      Specified by:
      matches in interface org.springframework.context.annotation.Condition
      Parameters:
      context - the condition context.
      metadata - metadata of the annotated element.
      Returns:
      true when at least one provider is configured.