Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@tsed/passport): Use originalUrl when authorize and authenticate …
…are used on method.
- Loading branch information
Romain Lenzotti
committed
May 27, 2020
1 parent
3ba44be
commit c84a1ce
Showing
6 changed files
with
64 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
import {UseAuth} from "@tsed/common"; | ||
import {AuthenticateOptions} from "passport"; | ||
import {AuthenticateOptions as PassportAuthenticateOptions} from "passport"; | ||
import {PassportMiddleware} from "../middlewares/PassportMiddleware"; | ||
|
||
export function Authenticate(protocol: string | string[] = "*", options: AuthenticateOptions & {security?: any} = {}): Function { | ||
export interface AuthenticateOptions extends PassportAuthenticateOptions { | ||
security?: any; | ||
originalUrl?: boolean; | ||
} | ||
|
||
export function Authenticate(protocol: string | string[] = "*", options: AuthenticateOptions = {}): Function { | ||
return UseAuth(PassportMiddleware, { | ||
protocol, | ||
method: "authenticate", | ||
security: options.security, | ||
originalUrl: options.originalUrl === undefined ? true : options.originalUrl, | ||
options | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters