@midwayjs/passport 4.0.0-beta.8 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,11 +23,11 @@ export interface IPassportStrategy {
23
23
  transformAuthInfo?(info: any, done: (err: any, info: any) => void): void;
24
24
  }
25
25
  export interface IPassportMiddleware extends IMiddleware<any, any> {
26
- authenticate?(options: AuthenticateOptions, callback: Function): any;
26
+ authenticate?(options: AuthenticateOptions, callback: (...args: any[]) => any): any;
27
27
  }
28
28
  export declare abstract class AbstractPassportMiddleware implements Pick<IPassportMiddleware, 'authenticate'> {
29
29
  abstract getAuthenticateOptions(): Promise<AuthenticateOptions> | AuthenticateOptions;
30
- authenticate?(options: AuthenticateOptions, callback?: Function): any;
30
+ authenticate?(options: AuthenticateOptions, callback?: (...args: any[]) => any): any;
31
31
  resolve(): any;
32
32
  }
33
33
  export interface StrategyCreatedStatic {
@@ -329,7 +329,6 @@ function PassportMiddleware(strategy) {
329
329
  }
330
330
  }
331
331
  res.statusCode = rstatus || 401;
332
- // eslint-disable-next-line eqeqeq
333
332
  if (res.statusCode === 401 && rchallenge.length) {
334
333
  res.setHeader('WWW-Authenticate', rchallenge);
335
334
  }
@@ -343,9 +342,7 @@ function PassportMiddleware(strategy) {
343
342
  req.login = req.logIn = (user, options, done) => {
344
343
  if (typeof options === 'function') {
345
344
  done = options;
346
- options = {};
347
345
  }
348
- options = options || {};
349
346
  const property = this.passport.getUserProperty();
350
347
  req[property] = user;
351
348
  if (this.passport.isEnableSession()) {
package/index.d.ts CHANGED
@@ -4,7 +4,10 @@ export * from './dist/index';
4
4
 
5
5
  declare module '@midwayjs/core/dist/interface' {
6
6
  interface MidwayConfig {
7
- passport?: AuthenticateOptions;
7
+ passport?: Omit<AuthenticateOptions, 'assignProperty'> & {
8
+ assignProperty?: boolean | string;
9
+ sessionUserProperty?: string;
10
+ };
8
11
  }
9
12
  }
10
13
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midwayjs/passport",
3
3
  "description": "midway passport component",
4
- "version": "4.0.0-beta.8",
4
+ "version": "4.0.0",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
7
7
  "files": [
@@ -22,12 +22,12 @@
22
22
  "author": "Nawbc",
23
23
  "license": "MIT",
24
24
  "devDependencies": {
25
- "@midwayjs/core": "^4.0.0-beta.8",
26
- "@midwayjs/express": "^4.0.0-beta.8",
27
- "@midwayjs/jwt": "^4.0.0-beta.8",
28
- "@midwayjs/koa": "^4.0.0-beta.8",
29
- "@midwayjs/mock": "^4.0.0-beta.8",
30
- "@midwayjs/web": "^4.0.0-beta.8",
25
+ "@midwayjs/core": "^4.0.0",
26
+ "@midwayjs/express": "^4.0.0",
27
+ "@midwayjs/jwt": "^4.0.0",
28
+ "@midwayjs/koa": "^4.0.0",
29
+ "@midwayjs/mock": "^4.0.0",
30
+ "@midwayjs/web": "^4.0.0",
31
31
  "@types/passport-local": "1.0.38",
32
32
  "after": "0.8.2",
33
33
  "express-session": "1.18.1",
@@ -36,5 +36,5 @@
36
36
  "passport-local": "1.0.0",
37
37
  "passport-openidconnect": "0.1.2"
38
38
  },
39
- "gitHead": "355e55949fdd132b0bdcb4830222a0a027e92ded"
39
+ "gitHead": "014f32c23ebc1d5ac21777c76be2fd373ce992d8"
40
40
  }