Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-22435: Bugfix spin cli trigger a pipeline user is admin or not for custom gate. #483

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ApplicationIdRbacInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
log.debug("Start of the preHandle -- ApplicationIdRbacInterceptor");
try {
log.info(
"Request intercepted for authorizing if the user is having enough access to perform the action");
Expand All @@ -43,7 +44,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
} catch (NumberFormatException nfe) {
log.debug("Ignoring the rbac check as it threw number format exception");
}

log.debug("End of the preHandle -- ApplicationIdRbacInterceptor");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ApprovalGateIdRbacInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {

log.debug("Start of the preHandle -- ApprovalGateIdRbacInterceptor");
try {
log.info(
"Request intercepted for authorizing if the user is having enough access to perform the action");
Expand All @@ -44,7 +44,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
} catch (NumberFormatException nfe) {
log.debug("Ignoring the rbac check as it threw number format exception");
}

log.debug("End of the preHandle -- ApprovalGateIdRbacInterceptor");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ApprovalGateInstanceIdRbacInterceptor implements HandlerInterceptor
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {

log.debug("Start of the preHandle -- ApprovalGateInstanceIdRbacInterceptor");
try {
log.info(
"Request intercepted for authorizing if the user is having enough access to perform the action");
Expand All @@ -44,7 +44,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
} catch (NumberFormatException nfe) {
log.debug("Ignoring the rbac check as it threw number format exception");
}

log.debug("End of the preHandle -- ApprovalGateInstanceIdRbacInterceptor");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ApprovalPolicyIdInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {

log.debug("Start of the preHandle -- ApprovalPolicyIdInterceptor");
try {
log.info(
"Request intercepted for authorizing if the user is having enough access to perform the action");
Expand All @@ -44,7 +44,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
} catch (NumberFormatException nfe) {
log.debug("Ignoring the rbac check as it threw number format exception");
}

log.debug("End of the preHandle -- ApprovalPolicyIdInterceptor");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class CustomGatesTriggerRbacInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {

log.debug("Start of the preHandle -- CustomGatesTriggerRbacInterceptor");
Optional.ofNullable(request.getHeader("x-spinnaker-user"))
.orElseThrow(
() -> new XSpinnakerUserHeaderMissingException("x-spinnaker-user header missing"));
Expand All @@ -50,7 +50,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
} catch (NumberFormatException nfe) {
log.debug("Ignoring the rbac check as it threw number format exception");
}

log.debug("End of the preHandle -- CustomGatesTriggerRbacInterceptor");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ public class FeatureVisibilityRbacInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
log.info("request intercepted to authorize if the user is having feature visibility");
log.debug("Start of the preHandle -- FeatureVisibilityRbacInterceptor");
log.info("request intercepted to authorize if the user is having feature visibility ");
String origin = request.getHeader(HttpHeaders.ORIGIN);
if (origin != null && customGatePlugins.contains(origin)) {
return true;
}
applicationFeatureRbac.authorizeUserForFeatureVisibility(request.getUserPrincipal().getName());
log.debug("End of the preHandle -- FeatureVisibilityRbacInterceptor");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class GateIdRbacInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {

log.debug("Start of the preHandle -- GateIdRbacInterceptor");
try {
log.info(
"Request intercepted for authorizing if the user is having enough access to perform the action");
Expand All @@ -44,7 +44,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
} catch (NumberFormatException nfe) {
log.debug("Ignoring the rbac check as it threw number format exception");
}

log.debug("End of the preHandle -- GateIdRbacInterceptor");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class PipelineIdRbacInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
log.debug("Start of the preHandle -- PipelineIdRbacInterceptor");
try {
log.info(
"Request intercepted for authorizing if the user is having enough access to perform the action");
Expand All @@ -59,7 +60,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
} catch (NumberFormatException nfe) {
log.debug("Ignoring the rbac check as it threw number format exception");
}

log.debug("End of the preHandle -- PipelineIdRbacInterceptor");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ServiceIdRbacInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
log.debug("Start of the preHandle -- ServiceIdRbacInterceptor");
try {
log.info(
"Request intercepted for authorizing if the user is having enough access to perform the action");
Expand All @@ -43,7 +44,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
} catch (NumberFormatException nfe) {
log.debug("Ignoring the rbac check as it threw number format exception");
}

log.debug("End of the preHandle -- ServiceIdRbacInterceptor");
return true;
}
}
Loading
Loading