Skip to content

Commit 19f2448

Browse files
author
Rodrigo Costa
committed
Add setAuth method to syncjwtauth
1 parent 7fcda05 commit 19f2448

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

syncjwtauth.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@ class SyncJWTAuth
1515
constructor (secret)
1616
{
1717
this._secret = secret;
18+
this._token = null;
19+
}
20+
21+
setAuth (token)
22+
{
23+
this._token = token;
1824
}
1925

2026
sign (message)
2127
{
22-
return { bearer: jwt.sign(message || {}, this._secret) };
28+
return this._token ? this._token :
29+
{ bearer: jwt.sign(message || {}, this._secret) };
2330
}
2431

2532
verify ( { bearer } )

0 commit comments

Comments
 (0)