Created
August 31, 2016 21:23
-
-
Save wendelicious/c2bd3bd22719ec1eff2cdd56d80d110b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
authBuilder | |
.verifiesClaimsBy( | |
c -> firebaseApplicationName.equals(c.getAudience()) | |
) | |
.verifiesClaimsBy( | |
c -> (ISSUER_PREFIX + firebaseApplicationName).equals(c.getIssuer()) | |
) | |
.verifiesClaimsBy( | |
c -> { | |
// we may not need this once we have our own signin provider proxied by Firebase | |
String email = c.getStringClaim(CLAIM_EMAIL); | |
if (email == null) return false; | |
return email.endsWith("@infusionsoft.com"); | |
} | |
) | |
.verifiesClaimsBy( | |
c -> c.getBooleanClaim(CLAIM_EMAIL_VERIFIED) | |
) | |
.verifiesClaimsBy( | |
c -> { | |
final String firebaseClaimString = c.getStringClaim(CLAIM_FIREBASE); | |
if (firebaseClaimString == null) return false; | |
final Map<String, Object> firebaseClaims = new Gson().fromJson(firebaseClaimString, HashMap.class); | |
final Object signinProvider = firebaseClaims.get(CLAIM_FIREBASE_SIGN_IN_PROVIDER); | |
return GOOGLE_SIGNIN_PROVIDER.equals(signinProvider); | |
} | |
) | |
; | |
// OR do we prefer: | |
authBuilder | |
.verifiesClaimsBy( | |
c -> firebaseApplicationName.equals(c.getAudience()) | |
, c -> (ISSUER_PREFIX + firebaseApplicationName).equals(c.getIssuer()) | |
, c -> { | |
// we may not need this once we have our own signin provider proxied by Firebase | |
String email = c.getStringClaim(CLAIM_EMAIL); | |
if (email == null) return false; | |
return email.endsWith("@infusionsoft.com"); | |
} | |
, c -> c.getBooleanClaim(CLAIM_EMAIL_VERIFIED) | |
, c -> { | |
final String firebaseClaimString = c.getStringClaim(CLAIM_FIREBASE); | |
if (firebaseClaimString == null) return false; | |
final Map<String, Object> firebaseClaims = new Gson().fromJson(firebaseClaimString, HashMap.class); | |
final Object signinProvider = firebaseClaims.get(CLAIM_FIREBASE_SIGN_IN_PROVIDER); | |
return GOOGLE_SIGNIN_PROVIDER.equals(signinProvider); | |
} | |
) | |
; |
also can i do this without lambdas?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is c?