Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'firebase' field in JWT payload #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Sources/FirebaseJWTMiddleware/FirebaseJWTPayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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/<projectId>", where <projectId> is the same project ID used for aud
Expand All @@ -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 {
Expand All @@ -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
}