Copilot commented on code in PR #12778:
URL: https://github.com/apache/gravitino/pull/12778#discussion_r3902542628
##########
web-v2/web/src/lib/store/auth/index.js:
##########
@@ -45,14 +44,23 @@ export const getAuthConfigs =
createAsyncThunk('auth/getAuthConfigs', async () =
// ** get the first authenticator from the response. response example:
"[simple, oauth]"
authType = res['gravitino.authenticators'][0].trim()
anthEnable = res['gravitino.authorization.enable']
- serviceAdmins = res['gravitino.authorization.serviceAdmins']
localStorage.setItem('oauthUrl', oauthUrl)
// Persist authType for axios interceptor to avoid circular dependency with
Redux store
localStorage.setItem('authType', authType)
- return { oauthUrl, authType, anthEnable, serviceAdmins, systemConfig: res }
+ return { oauthUrl, authType, anthEnable, systemConfig: res }
+})
+
+export const getAuthMe = createAsyncThunk('auth/getAuthMe', async () => {
+ const [err, res] = await to(getAuthMeApi())
+
+ if (err || !res) {
+ throw new Error(err)
+ }
+
+ return res
})
Review Comment:
Throwing `new Error(err)` is lossy when `err` is already an
`Error`/AxiosError object (it often becomes `Error: [object Object]` and drops
useful context). Prefer rethrowing the original error when it’s an `Error`, or
constructing a message from `err.message`/`String(err)`. If you want typed
rejected payloads, consider `createAsyncThunk`’s `rejectWithValue` for
consistent downstream handling.
##########
docs/open-api/authn.yaml:
##########
@@ -23,15 +23,16 @@ paths:
get:
tags:
- authentication
- summary: Get the authenticated principal
+ summary: Get the authenticated user
operationId: getAuthenticatedPrincipal
Review Comment:
The operation summary/description now describe 'authenticated user' and
includes `serviceAdmin`, but `operationId` still says
`getAuthenticatedPrincipal`. For OpenAPI codegen consumers, this naming
mismatch is confusing. Consider renaming it to something like
`getAuthenticatedUser` (or another neutral name) to reflect the expanded
response semantics.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]