Class FederatedLinkingPolicy

java.lang.Object
com.irurueta.authserver.authorization.domain.social.FederatedLinkingPolicy

public class FederatedLinkingPolicy extends Object
Rules of identity brokering: when an external identity may be tied to an account, and when it may be removed. It is pure; the use cases ask it and act on the answer.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    mayLinkByEmail(UserAccount account, String providerEmail, boolean providerVerified)
    Tells whether an external identity may be linked to the account that has its e-mail address.
    boolean
    mayProvision(String providerEmail, boolean providerVerified)
    Tells whether a new account may be created from an external identity: the provider must vouch for a usable e-mail address.
    boolean
    Tells whether a sign-in with an external provider may reach an account at all: a disabled account is never linked to an identity and never signed in through one, the rule every other sign-in method applies.
    boolean
    Tells whether a sign-in method (a linked identity, a bound certificate) may be removed: the account must keep at least one other way to sign in.

    Methods inherited from class java.lang.Object

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

    • FederatedLinkingPolicy

      public FederatedLinkingPolicy()
  • Method Details

    • mayLinkByEmail

      public boolean mayLinkByEmail(UserAccount account, String providerEmail, boolean providerVerified)
      Tells whether an external identity may be linked to the account that has its e-mail address. Both sides must vouch for the address: the provider says it is verified, and the account verified it too. Otherwise somebody could register an account with a victim's address, never verify it, and wait for the victim to sign in with a provider.
      Parameters:
      account - account that has the e-mail address.
      providerEmail - e-mail address the provider reported.
      providerVerified - whether the provider says it verified the address.
      Returns:
      true when the identity may be linked.
    • mayProvision

      public boolean mayProvision(String providerEmail, boolean providerVerified)
      Tells whether a new account may be created from an external identity: the provider must vouch for a usable e-mail address.
      Parameters:
      providerEmail - e-mail address the provider reported.
      providerVerified - whether the provider says it verified the address.
      Returns:
      true when the account may be provisioned.
    • maySignIn

      public boolean maySignIn(UserAccount account)
      Tells whether a sign-in with an external provider may reach an account at all: a disabled account is never linked to an identity and never signed in through one, the rule every other sign-in method applies.
      Parameters:
      account - the account the sign-in resolved to.
      Returns:
      true when the account may sign in.
    • mayUnlink

      public boolean mayUnlink(SignInMethods remaining)
      Tells whether a sign-in method (a linked identity, a bound certificate) may be removed: the account must keep at least one other way to sign in.
      Parameters:
      remaining - ways to sign in left once the method is removed.
      Returns:
      true when removing it is allowed.