You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ Therefore, a JWT typically looks like the following: xxxxx.yyyyy.zzzzz
66
66
#### Header
67
67
68
68
The Header struct contains the fields of the JSON Web Token header as defined by [RFC7515](https://tools.ietf.org/html/rfc7515#section-4).
69
-
The "typ" header will default to "JWT". The "alg" header will be set the algorithm name when you sign the JWT.
69
+
The "typ" header will default to "JWT". The "alg" header will be set to the algorithm name when you sign the JWT.
70
70
The other Header fields can be set when initializing the Header or by changing them directly on the Header object.
71
71
72
72
```swift
@@ -150,7 +150,7 @@ Initialize a JWTVerifier using the static function corresponding to the desired
150
150
```swift
151
151
let jwtVerifier = JWTVerifier.rs256(publicKey: publicKey)
152
152
```
153
-
To verify a signed JWT string, call the `sign` function on your JWT instance, passing in a JWTSigner:
153
+
To verify a signed JWT string, call the static `verify` function, passing in your JWT string and the JWTVerifier:
154
154
155
155
```swift
156
156
let verified = JWT<MyClaims>.verify(signedJWT, using: jwtVerifier)
@@ -211,8 +211,8 @@ The JWTEncoder and JWTDecoder classes encode and decode JWT Strings using the sa
211
211
Because JWTEncoder and JWTDecoder conform to [KituraContract's](https://github.com/IBM-Swift/KituraContracts/blob/master/Sources/KituraContracts/Contracts.swift) BodyEncoder and BodyDecoder protocols, they can be used as a [custom coder](https://developer.ibm.com/swift/2018/09/01/kitura-custom-encoders-and-decoders/) in Codable routes for sending and receiving JWTs:
This allows for the use of JWT's in information exchange. By sending and receiving JWT's you can ensure the sending is who they say they are and verify the content hasn't been tampered with.
Copy file name to clipboardExpand all lines: Sources/SwiftJWT/ClaimsExamples/ClaimsMicroProfile.swift
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,12 @@
16
16
17
17
import Foundation
18
18
19
-
// MARK MicroProfileClaims
19
+
// MARK ClaimsMicroProfile
20
20
21
21
/// A class representing the MicroProfile claims as listed in [MicroProfile specs](http://microprofile.io/project/eclipse/microprofile-jwt-auth/spec/src/main/asciidoc/interoperability.asciidoc).
22
22
publicclassClaimsMicroProfile:Claims{
23
23
24
+
/// Initialize a `ClaimsMicroProfile`
24
25
publicinit(
25
26
iss:String,
26
27
sub:String,
@@ -38,6 +39,7 @@ public class ClaimsMicroProfile: Claims {
38
39
self.upn = upn
39
40
self.groups = groups
40
41
}
42
+
41
43
/**
42
44
The MP-JWT issuer. [RFC7519, Section 4.1.1](https://tools.ietf.org/html/rfc7519#section-4.1.1)
0 commit comments