Skip to content

Commit 050b415

Browse files
committed
logout services for jwt
1 parent e5e62d7 commit 050b415

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

models/jwt/JwtService.cfc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ component accessors="true" singleton{
8383
}
8484
}
8585

86+
/**
87+
* Logout a user and invalidate their token
88+
*
89+
* @user
90+
* @customClaims
91+
*/
92+
function logout(){
93+
invalidate( this.getToken() );
94+
getAuthService().logout();
95+
}
96+
8697
/**
8798
* Create a token according to the passed user object and custom claims.
8899
* We are assuming the user is a valid and authenticated user.

test-harness/modules_app/api/handlers/Home.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ component {
7373
* logout
7474
*/
7575
function logout( event, rc, prc ){
76-
auth().logout();
76+
jwtAuth().logout();
7777
return { "error" : false, "data" : "", "message" : "Successfully logged out" };
7878
}
7979

0 commit comments

Comments
 (0)