Skip to content

Commit

Permalink
fix: blacklist url parsing (#47)
Browse files Browse the repository at this point in the history
* fix: blacklist url parsing

* fix: readme
  • Loading branch information
alessio-libardi authored Dec 4, 2023
1 parent 07b20d4 commit 9ecbd9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# NgxAuthUtils


> **IMPORTANT**
>
> The project has moved to https://github.com/zupit-it/zupit-angular
>
> npmjs: https://www.npmjs.com/package/@zupit-it/ng-auth
----------------------
---

An Angular library to ease the authentication integration with a backend.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ export class AuthExpiredInterceptor implements HttpInterceptor {
console.warn('ngx-auth-utils: Refresh token feature is enabled but unauthorizedUrlBlacklist is empty');
console.warn('ngx-auth-utils: Blacklist at least the refresh token URL for correct session expiration handling');
}
return this.unauthorizedUrlBlacklist.includes(new URL(url).pathname);

return this.unauthorizedUrlBlacklist.includes(this.getPathName(url));
}

private getPathName(url: string): string {
if (url.toLowerCase().startsWith('http')) {
return new URL(url).pathname;
}
return url;
}
}

0 comments on commit 9ecbd9f

Please sign in to comment.