Skip to content

Commit

Permalink
Add ability to specify typ of JWT when signing (vapor#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frizlab authored Oct 23, 2021
1 parent ca2edf6 commit 1822bb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/JWTKit/JWTSigner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ public final class JWTSigner {

public func sign<Payload>(
_ payload: Payload,
typ: String = "JWT",
kid: JWKIdentifier? = nil,
cty: String? = nil
) throws -> String
where Payload: JWTPayload
{
try JWTSerializer().sign(payload, using: self, kid: kid, cty: cty)
try JWTSerializer().sign(payload, using: self, typ: typ, kid: kid, cty: cty)
}

public func unverified<Payload>(
Expand Down
2 changes: 2 additions & 0 deletions Sources/JWTKit/JWTSigners.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@ public final class JWTSigners {

public func sign<Payload>(
_ payload: Payload,
typ: String = "JWT",
kid: JWKIdentifier? = nil
) throws -> String
where Payload: JWTPayload
{
return try JWTSerializer().sign(
payload,
using: self.require(kid: kid),
typ: typ,
kid: kid
)
}
Expand Down

0 comments on commit 1822bb0

Please sign in to comment.