WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { UserManager } from 'oidc-client'
 
class ApplicationUserManager extends UserManager {
  constructor () {
    super({
      authority: 'http://localhost:5004',
      client_id: 'blogadminjs',
      redirect_uri: 'http://localhost:2364/callback',
      response_type: 'id_token token',
      scope: 'openid profile roles blog.core.api jiepeiwms.api',
      post_logout_redirect_uri: 'http://localhost:2364'
    })
  }
 
  async login () {
    await this.signinRedirect()
    return this.getUser()
  }
 
  async logout () {
    return this.signoutRedirect()
  }
}
 
const applicationUserManager = new ApplicationUserManager()
export { applicationUserManager as default }