-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from auth0/swift-2.0
Swift 2.0
- Loading branch information
Showing
37 changed files
with
1,114 additions
and
469 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 |
---|---|---|
|
@@ -18,6 +18,7 @@ profile | |
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcscmblueprint | ||
|
||
# Bundler | ||
.bundle | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#Quick & Nimble | ||
|
||
github "Quick/Quick" ~> 0.3 | ||
github "Quick/Nimble" ~> 0.4 | ||
github "Quick/Quick" ~> 0.6 | ||
github "Quick/Nimble" "v2.0.0-rc.3" |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
github "Quick/Nimble" "v0.4.2" | ||
github "Quick/Quick" "v0.3.1" | ||
github "Quick/Nimble" "811003c1e556d6fedd12a6e8b81da235a7479aca" | ||
github "Quick/Quick" "v0.6.0" |
Submodule Nimble
updated
72 files
Submodule Quick
updated
50 files
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,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'xcpretty' |
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,10 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
xcpretty (0.1.12) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
xcpretty |
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,56 @@ | ||
/*: | ||
# JWTDecode.swift | ||
A swift framework to help you decode a [JWT](http://jwt.io) token in your iOS/OSX applications | ||
*/ | ||
|
||
//: First we need to import JWTDecode framework | ||
import JWTDecode | ||
|
||
/*: | ||
Then paste here the token you wish to decode | ||
*/ | ||
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tIiwic3ViIjoiYXV0aDB8MTAxMDEwMTAxMCIsImF1ZCI6Imh0dHBzOi8vc2FtcGxlcy5hdXRoMC5jb20iLCJleHAiOjEzNzI2NzQzMzYsImlhdCI6MTM3MjYzODMzNiwianRpIjoicXdlcnR5MTIzNDU2IiwibmJmIjoxMzcyNjM4MzM2fQ.LvF9wSheCB5xarpydmurWgi9NOZkdES5AbNb_UWk9Ew" | ||
//: You can generate a new token in [jwt.io](http://jwt.io) | ||
|
||
/*: | ||
## Decode | ||
Then here we try to decode it calling `decode(token: String) -> JWT` that will return an object with all the decoded values | ||
*/ | ||
do { | ||
let jwt = try decode(token) | ||
|
||
//: ### JWT parts | ||
|
||
//: Header dictionary | ||
jwt.header | ||
//: Claims in token body | ||
jwt.body | ||
//: Token signature | ||
jwt.signature | ||
|
||
//: ### Registered Claims | ||
|
||
//: "aud" (Audience) | ||
jwt.audience | ||
//: "sub" (Subject) | ||
jwt.subject | ||
//: "jti" (JWT ID) | ||
jwt.identifier | ||
//: "iss" (Issuer) | ||
jwt.issuer | ||
//: "nbf" (Not Before) | ||
jwt.notBefore | ||
//: "iat" (Issued At) | ||
jwt.issuedAt | ||
//: "exp" (Expiration Time) | ||
jwt.expiresAt | ||
|
||
//: ### Custom Claims | ||
//: If we also have our custom claims we can retrive them calling `claim<T>(name: String) -> T?` where `T` is the value type of the claim, e.g.: a `String` | ||
|
||
let custom: String? = jwt.claim("email") | ||
//: ### Error Handling | ||
//: If the token is invalid an `NSError` will be thrown | ||
} catch let error as NSError { | ||
error.localizedDescription | ||
} |
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,4 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<playground version='5.0' target-platform='ios' requires-full-environment='true' display-mode='rendered'> | ||
<timeline fileName='timeline.xctimeline'/> | ||
</playground> |
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,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Timeline | ||
version = "3.0"> | ||
<TimelineItems> | ||
<LoggerValueHistoryTimelineItem | ||
documentLocation = "#CharacterRangeLen=0&CharacterRangeLoc=1536&EndingColumnNumber=13&EndingLineNumber=26&StartingColumnNumber=5&StartingLineNumber=26&Timestamp=463532561.17046" | ||
selectedRepresentationIndex = "0" | ||
shouldTrackSuperviewWidth = "NO"> | ||
</LoggerValueHistoryTimelineItem> | ||
<LoggerValueHistoryTimelineItem | ||
documentLocation = "#CharacterRangeLen=0&CharacterRangeLoc=1536&EndingColumnNumber=18&EndingLineNumber=26&StartingColumnNumber=5&StartingLineNumber=26&Timestamp=463532561.170751" | ||
selectedRepresentationIndex = "0" | ||
shouldTrackSuperviewWidth = "NO"> | ||
</LoggerValueHistoryTimelineItem> | ||
<LoggerValueHistoryTimelineItem | ||
documentLocation = "#CharacterRangeLen=0&CharacterRangeLoc=1536&EndingColumnNumber=17&EndingLineNumber=26&StartingColumnNumber=5&StartingLineNumber=26&Timestamp=463532561.170973" | ||
selectedRepresentationIndex = "0" | ||
shouldTrackSuperviewWidth = "NO"> | ||
</LoggerValueHistoryTimelineItem> | ||
<LoggerValueHistoryTimelineItem | ||
documentLocation = "#CharacterRangeLen=0&CharacterRangeLoc=1536&EndingColumnNumber=17&EndingLineNumber=26&StartingColumnNumber=5&StartingLineNumber=26&Timestamp=463532561.171144" | ||
selectedRepresentationIndex = "0" | ||
shouldTrackSuperviewWidth = "NO"> | ||
</LoggerValueHistoryTimelineItem> | ||
<LoggerValueHistoryTimelineItem | ||
documentLocation = "#CharacterRangeLen=13&CharacterRangeLoc=1548&EndingColumnNumber=18&EndingLineNumber=26&StartingColumnNumber=5&StartingLineNumber=26&Timestamp=463532561.171315" | ||
selectedRepresentationIndex = "0" | ||
shouldTrackSuperviewWidth = "NO"> | ||
</LoggerValueHistoryTimelineItem> | ||
<LoggerValueHistoryTimelineItem | ||
documentLocation = "#CharacterRangeLen=1&CharacterRangeLoc=1597&EndingColumnNumber=10&EndingLineNumber=54&StartingColumnNumber=5&StartingLineNumber=54&Timestamp=463532561.171487" | ||
selectedRepresentationIndex = "0" | ||
shouldTrackSuperviewWidth = "NO"> | ||
</LoggerValueHistoryTimelineItem> | ||
<LoggerValueHistoryTimelineItem | ||
documentLocation = "#CharacterRangeLen=12&CharacterRangeLoc=1586&EndingColumnNumber=17&EndingLineNumber=54&StartingColumnNumber=5&StartingLineNumber=54&Timestamp=463532561.171656" | ||
selectedRepresentationIndex = "0" | ||
shouldTrackSuperviewWidth = "NO"> | ||
</LoggerValueHistoryTimelineItem> | ||
</TimelineItems> | ||
</Timeline> |
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
Oops, something went wrong.