This is an automated email from the ASF dual-hosted git repository.
aicam pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new 5650e9538d fix(access-control-service): fix formatting of
`AccessControlResource` (#3838)
5650e9538d is described below
commit 5650e9538d675c77b4c9c40d34b747955ec68d78
Author: ali risheh <[email protected]>
AuthorDate: Tue Oct 7 20:17:17 2025 -0700
fix(access-control-service): fix formatting of `AccessControlResource`
(#3838)
---
.../service/resource/AccessControlResource.scala | 39 ++++++++++++----------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git
a/core/access-control-service/src/main/scala/edu/uci/ics/texera/service/resource/AccessControlResource.scala
b/core/access-control-service/src/main/scala/edu/uci/ics/texera/service/resource/AccessControlResource.scala
index 8bca493850..2ff2355ca8 100644
---
a/core/access-control-service/src/main/scala/edu/uci/ics/texera/service/resource/AccessControlResource.scala
+++
b/core/access-control-service/src/main/scala/edu/uci/ics/texera/service/resource/AccessControlResource.scala
@@ -38,11 +38,11 @@ object AccessControlResource extends LazyLogging {
/**
* Authorize the request based on the path and headers.
- * @param uriInfo URI sent by Envoy or API Gateway
- * @param headers HTTP headers sent by Envoy or API Gateway which include
- * headers sent by the client (browser)
- * @return HTTP Response with appropriate status code and headers
- */
+ * @param uriInfo URI sent by Envoy or API Gateway
+ * @param headers HTTP headers sent by Envoy or API Gateway which include
+ * headers sent by the client (browser)
+ * @return HTTP Response with appropriate status code and headers
+ */
def authorize(uriInfo: UriInfo, headers: HttpHeaders): Response = {
val path = uriInfo.getPath
logger.info(s"Authorizing request for path: $path")
@@ -64,7 +64,9 @@ object AccessControlResource extends LazyLogging {
.mapValues(values => values.asScala.headOption.getOrElse(""))
.toMap
- logger.info(s"Request URI: ${uriInfo.getRequestUri} and headers:
${headers.getRequestHeaders.asScala} and queryParams: $queryParams")
+ logger.info(
+ s"Request URI: ${uriInfo.getRequestUri} and headers:
${headers.getRequestHeaders.asScala} and queryParams: $queryParams"
+ )
val token = queryParams.getOrElse(
"access-token",
@@ -76,12 +78,13 @@ object AccessControlResource extends LazyLogging {
.replace("Bearer ", "")
)
val cuid = queryParams.getOrElse("cuid", "")
- val cuidInt = try {
- cuid.toInt
- } catch {
- case _: NumberFormatException =>
- return Response.status(Response.Status.FORBIDDEN).build()
- }
+ val cuidInt =
+ try {
+ cuid.toInt
+ } catch {
+ case _: NumberFormatException =>
+ return Response.status(Response.Status.FORBIDDEN).build()
+ }
var cuAccess: PrivilegeEnum = PrivilegeEnum.NONE
var userSession: Optional[SessionUser] = Optional.empty()
@@ -115,18 +118,18 @@ class AccessControlResource extends LazyLogging {
@GET
@Path("/{path:.*}")
def authorizeGet(
- @Context uriInfo: UriInfo,
- @Context headers: HttpHeaders
- ): Response = {
+ @Context uriInfo: UriInfo,
+ @Context headers: HttpHeaders
+ ): Response = {
AccessControlResource.authorize(uriInfo, headers)
}
@POST
@Path("/{path:.*}")
def authorizePost(
- @Context uriInfo: UriInfo,
- @Context headers: HttpHeaders
- ): Response = {
+ @Context uriInfo: UriInfo,
+ @Context headers: HttpHeaders
+ ): Response = {
AccessControlResource.authorize(uriInfo, headers)
}
}