@@ -34,8 +34,6 @@ export class AuthService {
34
34
private readonly JWT_REFRESH_SECRET : string ,
35
35
@Inject ( 'JWT_REFRESH_EXPIRES_IN' )
36
36
private readonly JWT_REFRESH_EXPIRES_IN : string ,
37
- @Inject ( 'WHITELISTED_USERS' )
38
- private readonly WHITELISTED_USERS : string ,
39
37
@Inject ( 'APP_DOMAIN' )
40
38
private readonly APP_DOMAIN ?: string ,
41
39
) { }
@@ -83,10 +81,6 @@ export class AuthService {
83
81
profileImage : user . photos [ 0 ] . value ,
84
82
} ;
85
83
86
- if ( ! ( await this . verifyWhitelist ( profile . username ) ) ) {
87
- return res . redirect ( this . FRONTEND_URL + '/login' ) ;
88
- }
89
-
90
84
// verify if user exists
91
85
const user_registered = await this . verifyAndGetUser ( profile ) ;
92
86
@@ -123,23 +117,6 @@ export class AuthService {
123
117
return user_registered ;
124
118
}
125
119
126
- private async verifyWhitelist ( username : string ) {
127
- const whitelist = this . WHITELISTED_USERS ;
128
-
129
- if ( whitelist . length === 0 ) {
130
- return true ;
131
- }
132
-
133
- if ( whitelist . includes ( username . toLowerCase ( ) ) ) {
134
- this . logger . log ( `User ${ username } is whitelisted; approving login` ) ;
135
- return true ;
136
- }
137
-
138
- this . logger . log ( `User ${ username } is not whitelisted; rejecting login` ) ;
139
-
140
- return false ;
141
- }
142
-
143
120
public async githubLogin ( req : Request , res : Response ) {
144
121
const user = req . user as GithubAccessToken ;
145
122
const { profile } = user ;
@@ -156,10 +133,6 @@ export class AuthService {
156
133
157
134
const email = response . data . filter ( ( email ) => email . primary ) [ 0 ] . email ;
158
135
159
- if ( ! ( await this . verifyWhitelist ( profile . username ) ) ) {
160
- return res . redirect ( this . FRONTEND_URL + '/login' ) ;
161
- }
162
-
163
136
const user_registered = await this . verifyAndGetUser ( {
164
137
username : profile . username ,
165
138
email : email ,
@@ -180,10 +153,6 @@ export class AuthService {
180
153
profileImage : profilePictureUrl ,
181
154
} ;
182
155
183
- if ( ! ( await this . verifyWhitelist ( profile . username ) ) ) {
184
- return res . redirect ( this . FRONTEND_URL + '/login' ) ;
185
- }
186
-
187
156
// verify if user exists
188
157
const user_registered = await this . verifyAndGetUser ( profile ) ;
189
158
0 commit comments