You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.ok_or_else(|| ErrorCode::AuthenticateFailure("[AUTH] JWT authentication failed: JWT auth is not configured on this server"))?;
133
+
let jwt_auth = self.jwt_auth.as_ref().ok_or_else(|| {
134
+
ErrorCode::AuthenticateFailure(
135
+
"JWT authentication failed: JWT auth is not configured on this server",
136
+
)
137
+
})?;
137
138
let jwt = jwt_auth.parse_jwt_claims(t.as_str()).await?;
138
139
let user_name = jwt.subject.ok_or_else(|| {
139
140
ErrorCode::AuthenticateFailure(
140
-
"[AUTH] JWT authentication failed: subject claim (user name) is missing in the token",
141
+
"JWT authentication failed: subject claim (user name) is missing in the token",
141
142
)
142
143
})?;
143
144
@@ -157,7 +158,7 @@ impl AuthMgr {
157
158
{
158
159
Ok(mut user_info) => {
159
160
if user_info.auth_info != AuthInfo::JWT{
160
-
returnErr(ErrorCode::AuthenticateFailure("[AUTH] Authentication failed: user exists but is not configured for JWT authentication"));
161
+
returnErr(ErrorCode::AuthenticateFailure("Authentication failed: user exists but is not configured for JWT authentication"));
161
162
}
162
163
ifletSome(ensure_user) = jwt.custom.ensure_user{
163
164
let current_roles = user_info.grants.roles();
@@ -166,7 +167,7 @@ impl AuthMgr {
166
167
for role in roles.iter(){
167
168
if !current_roles.contains(role){
168
169
info!(
169
-
"[AUTH] JWT grant role to user: {} -> {}",
170
+
"JWT grant role to user: {} -> {}",
170
171
user_info.name, role
171
172
);
172
173
user_api
@@ -185,7 +186,7 @@ impl AuthMgr {
185
186
// grant default role to user if not exists
186
187
if !current_roles.contains(jwt_default_role){
187
188
info!(
188
-
"[AUTH] JWT grant default role to user: {} -> {}",
189
+
"JWT grant default role to user: {} -> {}",
189
190
user_info.name, jwt_default_role
190
191
);
191
192
user_api
@@ -200,7 +201,7 @@ impl AuthMgr {
200
201
// ensure default role to jwt role
201
202
if user_info.option.default_role() != Some(jwt_default_role){
202
203
info!(
203
-
"[AUTH] JWT update default role for user: {} -> {}",
204
+
"JWT update default role for user: {} -> {}",
204
205
user_info.name, jwt_default_role
205
206
);
206
207
user_api
@@ -226,15 +227,15 @@ impl AuthMgr {
226
227
}
227
228
_ => {
228
229
returnErr(ErrorCode::AuthenticateFailure(format!(
229
-
"[AUTH] Authentication failed: {}",
230
+
"Authentication failed: {}",
230
231
e.message()
231
232
)))
232
233
}
233
234
}
234
235
let ensure_user = jwt
235
236
.custom
236
237
.ensure_user
237
-
.ok_or_else(|| ErrorCode::AuthenticateFailure(format!("[AUTH] JWT authentication failed: ensure_user claim is missing and user does not exist: {}", e.message())))?;
238
+
.ok_or_else(|| ErrorCode::AuthenticateFailure(format!("JWT authentication failed: ensure_user claim is missing and user does not exist: {}", e.message())))?;
0 commit comments