File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ /// <reference path="../angularjs/angular.d.ts" />
2
+ /// <reference path="angular-jwt.d.ts" />
3
+
4
+ var app = angular . module ( "angular-jwt-tests" , [ "angular-jwt" ] ) ;
5
+
6
+ var $jwtHelper : angular . jwt . IJwtHelper ;
7
+
8
+ var expToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tLyIsInN1YiI6ImZhY2Vib29rfDEwMTU0Mjg3MDI3NTEwMzAyIiwiYXVkIjoiQlVJSlNXOXg2MHNJSEJ3OEtkOUVtQ2JqOGVESUZ4REMiLCJleHAiOjE0MTIyMzQ3MzAsImlhdCI6MTQxMjE5ODczMH0.7M5sAV50fF1-_h9qVbdSgqAnXVF7mz3I6RjS6JiH0H8' ;
9
+ var tokenPayload = $jwtHelper . decodeToken ( expToken ) ;
10
+ var date = $jwtHelper . getTokenExpirationDate ( expToken ) ;
11
+ var bool = $jwtHelper . isTokenExpired ( expToken ) ;
12
+
13
+ var $jwtInterceptor : angular . jwt . IJwtInterceptor ;
14
+
15
+ $jwtInterceptor . tokenGetter = ( ) => {
16
+ return expToken ;
17
+ }
Original file line number Diff line number Diff line change
1
+ // Type definitions for angular-jwt 0.0.8
2
+ // Project: https://github.com/auth0/angular-jwt
3
+ // Definitions by: Reto Rezzonico <https://github.com/rerezz>
4
+ // Definitions: https://github.com/borisyankov/DefinitelyTyped
5
+
6
+ /// <reference path="../angularjs/angular.d.ts" />
7
+
8
+ declare module angular . jwt {
9
+
10
+ interface JwtToken {
11
+ iss : string ;
12
+ sub : string ;
13
+ aud : string ;
14
+ exp : number ;
15
+ nbf : number ;
16
+ iat : number ;
17
+ jti : string ;
18
+ unique_name : string ;
19
+ }
20
+
21
+ interface IJwtHelper {
22
+ decodeToken ( token : string ) : JwtToken ;
23
+ getTokenExpirationDate ( token : any ) : Date ;
24
+ isTokenExpired ( token : any , offsetSeconds ?: number ) : boolean ;
25
+ }
26
+
27
+ interface IJwtInterceptor {
28
+ tokenGetter ( ) : string ;
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments