aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/auth
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core/auth')
-rw-r--r--client/src/app/core/auth/auth-user.model.ts18
-rw-r--r--client/src/app/core/auth/auth.service.ts4
2 files changed, 11 insertions, 11 deletions
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts
index cd9665e37..a12325421 100644
--- a/client/src/app/core/auth/auth-user.model.ts
+++ b/client/src/app/core/auth/auth-user.model.ts
@@ -1,7 +1,7 @@
1import { Observable, of } from 'rxjs' 1import { Observable, of } from 'rxjs'
2import { map } from 'rxjs/operators' 2import { map } from 'rxjs/operators'
3import { User } from '@app/core/users/user.model' 3import { User } from '@app/core/users/user.model'
4import { UserTokens } from '@root-helpers/users' 4import { OAuthUserTokens } from '@root-helpers/users'
5import { hasUserRight } from '@shared/core-utils/users' 5import { hasUserRight } from '@shared/core-utils/users'
6import { 6import {
7 MyUser as ServerMyUserModel, 7 MyUser as ServerMyUserModel,
@@ -13,33 +13,33 @@ import {
13} from '@shared/models' 13} from '@shared/models'
14 14
15export class AuthUser extends User implements ServerMyUserModel { 15export class AuthUser extends User implements ServerMyUserModel {
16 tokens: UserTokens 16 oauthTokens: OAuthUserTokens
17 specialPlaylists: MyUserSpecialPlaylist[] 17 specialPlaylists: MyUserSpecialPlaylist[]
18 18
19 canSeeVideosLink = true 19 canSeeVideosLink = true
20 20
21 constructor (userHash: Partial<ServerMyUserModel>, hashTokens: Partial<UserTokens>) { 21 constructor (userHash: Partial<ServerMyUserModel>, hashTokens: Partial<OAuthUserTokens>) {
22 super(userHash) 22 super(userHash)
23 23
24 this.tokens = new UserTokens(hashTokens) 24 this.oauthTokens = new OAuthUserTokens(hashTokens)
25 this.specialPlaylists = userHash.specialPlaylists 25 this.specialPlaylists = userHash.specialPlaylists
26 } 26 }
27 27
28 getAccessToken () { 28 getAccessToken () {
29 return this.tokens.accessToken 29 return this.oauthTokens.accessToken
30 } 30 }
31 31
32 getRefreshToken () { 32 getRefreshToken () {
33 return this.tokens.refreshToken 33 return this.oauthTokens.refreshToken
34 } 34 }
35 35
36 getTokenType () { 36 getTokenType () {
37 return this.tokens.tokenType 37 return this.oauthTokens.tokenType
38 } 38 }
39 39
40 refreshTokens (accessToken: string, refreshToken: string) { 40 refreshTokens (accessToken: string, refreshToken: string) {
41 this.tokens.accessToken = accessToken 41 this.oauthTokens.accessToken = accessToken
42 this.tokens.refreshToken = refreshToken 42 this.oauthTokens.refreshToken = refreshToken
43 } 43 }
44 44
45 hasRight (right: UserRight) { 45 hasRight (right: UserRight) {
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 7f4fae4aa..4de28e51e 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -5,7 +5,7 @@ import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular
5import { Injectable } from '@angular/core' 5import { Injectable } from '@angular/core'
6import { Router } from '@angular/router' 6import { Router } from '@angular/router'
7import { Notifier } from '@app/core/notification/notifier.service' 7import { Notifier } from '@app/core/notification/notifier.service'
8import { logger, objectToUrlEncoded, peertubeLocalStorage, UserTokens } from '@root-helpers/index' 8import { logger, OAuthUserTokens, objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index'
9import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' 9import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models'
10import { environment } from '../../../environments/environment' 10import { environment } from '../../../environments/environment'
11import { RestExtractor } from '../rest/rest-extractor.service' 11import { RestExtractor } from '../rest/rest-extractor.service'
@@ -74,7 +74,7 @@ export class AuthService {
74 ] 74 ]
75 } 75 }
76 76
77 buildAuthUser (userInfo: Partial<User>, tokens: UserTokens) { 77 buildAuthUser (userInfo: Partial<User>, tokens: OAuthUserTokens) {
78 this.user = new AuthUser(userInfo, tokens) 78 this.user = new AuthUser(userInfo, tokens)
79 } 79 }
80 80