-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
87 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// Helper+JWTDecode.swift | ||
// XCreds | ||
// | ||
// Created by Timothy Perfitt on 10/6/22. | ||
// | ||
|
||
import Foundation | ||
func jwtDecode(value: String) -> Dictionary<String, Any>? { | ||
|
||
let array = value.components(separatedBy: ".") | ||
|
||
if array.count != 3 { | ||
TCSLogWithMark("idToken is invalid") | ||
return nil | ||
} | ||
let body = array[1] | ||
guard let data = base64UrlDecode(value:body ) else { | ||
TCSLogWithMark("error decoding id token base64") | ||
return nil | ||
} | ||
|
||
var idTokenObject:Dictionary<String, Any>? | ||
do { | ||
|
||
idTokenObject = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.mutableContainers) as? Dictionary<String, Any> | ||
|
||
guard let idTokenObject = idTokenObject else { | ||
return nil | ||
} | ||
return idTokenObject | ||
|
||
} | ||
catch { | ||
return nil | ||
|
||
} | ||
|
||
} |
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
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
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
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
Binary file modified
BIN
+7.1 KB
(100%)
...deproj/project.xcworkspace/xcuserdata/tperfitt.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
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