From e6598c6536d030a0ee788d8aeb81777db8eb235e Mon Sep 17 00:00:00 2001 From: Guven Bolukbasi Date: Thu, 2 Jan 2020 11:14:57 +0300 Subject: [PATCH 1/2] updated gitignore so that DS_Store and XCode user settings are no longer tracked --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 89b6978..0a75e53 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ JSONWebToken.xcodeproj/xcuserdata + +# User specific settings of XCode +xcuserdata/ + +# macOS specific +.DS_Store From 9c4d91deada623a2686d11c43cd71ab6b7520564 Mon Sep 17 00:00:00 2001 From: Guven Bolukbasi Date: Thu, 2 Jan 2020 11:15:54 +0300 Subject: [PATCH 2/2] added the Boolean claim transformer --- JSONWebToken/ClaimValidator.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/JSONWebToken/ClaimValidator.swift b/JSONWebToken/ClaimValidator.swift index f2de023..eeb57ba 100644 --- a/JSONWebToken/ClaimValidator.swift +++ b/JSONWebToken/ClaimValidator.swift @@ -30,6 +30,13 @@ public func ClaimTransformNumber(_ value : Any) throws -> NSNumber { throw ClaimValidatorError(message: "\(value) is not a Number type value") } } +public func ClaimTransformBool(_ value : Any) throws -> Bool { + if let boolValue = value as? Bool { + return boolValue + } else { + throw ClaimValidatorError(message: "\(value) is not a Bool type value") + } +} public func ClaimTransformArray(_ elementTransform : (Any) throws -> U, value : Any) throws -> [U] { if let array = value as? NSArray { return try array.map(elementTransform)