java.lang.Object
com.irurueta.authserver.authorization.infrastructure.github.GitHubEmailMapper

@Component public class GitHubEmailMapper extends Object
Maps the e-mail addresses GitHub lists onto the one address the domain wants: the address GitHub marks as both primary and verified. A verified address that is not the primary one, or a primary one that is not verified, does not count.
  • Constructor Details

    • GitHubEmailMapper

      public GitHubEmailMapper()
  • Method Details

    • verifiedPrimary

      public Optional<String> verifiedPrimary(List<Email> emails)
      Picks the verified primary address.
      Parameters:
      emails - the addresses GitHub answered, possibly null for an empty body.
      Returns:
      the address, or an empty optional when none is both primary and verified.