ef-keycloak-connect 1.6.4 → 1.6.5
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.
- package/package.json +1 -1
- package/services/errorService.js +26 -0
- package/services/finesseService.js +24 -12
- package/services/keycloakService.js +14 -9
package/package.json
CHANGED
package/services/errorService.js
CHANGED
|
@@ -27,6 +27,15 @@ class ErrorService {
|
|
|
27
27
|
reason: `Hostname Not Found, Keycloak server unaccessable against Keycloak URL. Unable to resolve Hostname, This maybe due to wrong Host URL or DNS server issue`,
|
|
28
28
|
};
|
|
29
29
|
default:
|
|
30
|
+
|
|
31
|
+
if ( typeof ( err.response.data ) === "object" ) {
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
status: err.response.status,
|
|
35
|
+
reason: err.response.data.error
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
30
39
|
return {
|
|
31
40
|
status: err.response.status,
|
|
32
41
|
reason: err.response.data,
|
|
@@ -72,6 +81,15 @@ class ErrorService {
|
|
|
72
81
|
reason: 'Provided User Credentials are not valid, please provide a valid User Credentials',
|
|
73
82
|
};
|
|
74
83
|
default:
|
|
84
|
+
|
|
85
|
+
if ( typeof ( err.response.data ) === "object" ) {
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
status: err.response.status,
|
|
89
|
+
reason: err.response.data.error
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
75
93
|
return {
|
|
76
94
|
status: err.response.status,
|
|
77
95
|
reason: err.response.data,
|
|
@@ -81,6 +99,14 @@ class ErrorService {
|
|
|
81
99
|
|
|
82
100
|
} else {
|
|
83
101
|
|
|
102
|
+
if ( typeof ( err.response.data ) === "object" ) {
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
status: err.response.status,
|
|
106
|
+
reason: err.response.data.error
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
84
110
|
return {
|
|
85
111
|
status: err.response.status,
|
|
86
112
|
reason: err.response.data,
|
|
@@ -78,16 +78,22 @@ class FinesseService {
|
|
|
78
78
|
if ( er.code == "ENOTFOUND" ) {
|
|
79
79
|
|
|
80
80
|
reject( {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
error_message: "Error Occured While Authenticating User Via Finesse",
|
|
82
|
+
error_detail: {
|
|
83
|
+
status: 408,
|
|
84
|
+
reason: `finesse server not accessible against URL: ${finesseUrl}`
|
|
85
|
+
}
|
|
86
|
+
} )
|
|
84
87
|
|
|
85
88
|
} else if ( er.response ) {
|
|
86
89
|
|
|
87
90
|
reject( {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
error_message: "Error Occured While Authenticating User Via Finesse",
|
|
92
|
+
error_detail: {
|
|
93
|
+
status: er.response.status,
|
|
94
|
+
reason: er.response.statusText
|
|
95
|
+
}
|
|
96
|
+
} )
|
|
91
97
|
|
|
92
98
|
}
|
|
93
99
|
|
|
@@ -126,16 +132,22 @@ class FinesseService {
|
|
|
126
132
|
if ( er.code == "ENOTFOUND" ) {
|
|
127
133
|
|
|
128
134
|
reject( {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
error_message: "Error Occured While Authenticating User Via Finesse SSO",
|
|
136
|
+
error_detail: {
|
|
137
|
+
status: 408,
|
|
138
|
+
reason: `finesse server not accessible against URL: ${finesseUrl}`
|
|
139
|
+
}
|
|
140
|
+
} )
|
|
132
141
|
|
|
133
142
|
} else if ( er.response ) {
|
|
134
143
|
|
|
135
144
|
reject( {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
error_message: "Error Occured While Authenticating User Via Finesse SSO",
|
|
146
|
+
error_detail: {
|
|
147
|
+
status: er.response.status,
|
|
148
|
+
reason: er.response.statusText
|
|
149
|
+
}
|
|
150
|
+
} )
|
|
139
151
|
|
|
140
152
|
}
|
|
141
153
|
}
|
|
@@ -334,9 +334,12 @@ class KeycloakService extends Keycloak {
|
|
|
334
334
|
|
|
335
335
|
if ( !userInfo.data.active ) {
|
|
336
336
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
reject( {
|
|
338
|
+
error_message: "Error Occured While Getting User Info From Token",
|
|
339
|
+
error_detail: {
|
|
340
|
+
status: 401,
|
|
341
|
+
reason: `Provided Access Token Expired. Please Provide Valid Access Token`
|
|
342
|
+
}
|
|
340
343
|
} );
|
|
341
344
|
|
|
342
345
|
}
|
|
@@ -344,9 +347,14 @@ class KeycloakService extends Keycloak {
|
|
|
344
347
|
let clientRoles = userInfo.data.resource_access;
|
|
345
348
|
resolve( clientRoles );
|
|
346
349
|
|
|
347
|
-
} catch (
|
|
350
|
+
} catch ( er ) {
|
|
348
351
|
|
|
349
|
-
|
|
352
|
+
error = await errorService.handleError( er );
|
|
353
|
+
|
|
354
|
+
reject( {
|
|
355
|
+
error_message: "Error Occured While Getting User Info From Token",
|
|
356
|
+
error_detail: error
|
|
357
|
+
} );
|
|
350
358
|
}
|
|
351
359
|
|
|
352
360
|
} );
|
|
@@ -1108,10 +1116,7 @@ class KeycloakService extends Keycloak {
|
|
|
1108
1116
|
error_message: "Error Occured While Fetching User Team.",
|
|
1109
1117
|
error_detail: {
|
|
1110
1118
|
status: 403,
|
|
1111
|
-
reason:
|
|
1112
|
-
error: "access_denied",
|
|
1113
|
-
error_description: "No Teams group assigned to User, please assign a Team to user. If user has no team then assign it default group."
|
|
1114
|
-
}
|
|
1119
|
+
reason: "No Teams group assigned to User, please assign a Team to user. If user has no team then assign it default group."
|
|
1115
1120
|
}
|
|
1116
1121
|
} );
|
|
1117
1122
|
|