From 763f839ba50a878aa82b0dc1e8f4fd0b3041eb59 Mon Sep 17 00:00:00 2001 From: simonederiu <86783729+simonederiu@users.noreply.github.com> Date: Mon, 30 Aug 2021 16:09:13 +0200 Subject: [PATCH] Added 'firebase' field in JWT payload Added the 'firebase' field in payload to retrieve sign_in_provider and identities. --- Sources/FirebaseJWTMiddleware/FirebaseJWTPayload.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/FirebaseJWTMiddleware/FirebaseJWTPayload.swift b/Sources/FirebaseJWTMiddleware/FirebaseJWTPayload.swift index 3a96969..d536fc3 100644 --- a/Sources/FirebaseJWTMiddleware/FirebaseJWTPayload.swift +++ b/Sources/FirebaseJWTMiddleware/FirebaseJWTPayload.swift @@ -21,6 +21,7 @@ public struct FirebaseJWTPayload: JWTPayload { case authTime = "auth_time" case isEmailVerified = "email_verified" case phoneNumber = "phone_number" + case firebase = "firebase" } /// Issuer. It must be "https://securetoken.google.com/", where is the same project ID used for aud @@ -47,6 +48,7 @@ public struct FirebaseJWTPayload: JWTPayload { public let name: String? public let isEmailVerified: Bool? public let phoneNumber: String? + public let firebase: Firebase? public func verify(using signer: JWTSigner) throws { guard self.issuer.value.contains("securetoken.google.com") else { @@ -60,3 +62,9 @@ public struct FirebaseJWTPayload: JWTPayload { try self.expirationAt.verifyNotExpired() } } + +public struct Firebase: Codable { + public let identities: [String: [String]] + public let sign_in_provider: String +} +