use of org.openkilda.auth.model.Permissions in project open-kilda by telstra.
the class FlowController method getFlowById.
/**
* Get flow by Id.
*
* @param flowId
* id of flow requested.
* @return flowInfo
* @throws AccessDeniedException the access denied exception
*/
@RequestMapping(value = "/{flowId}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = { IConstants.Permission.MENU_FLOWS })
@ResponseBody
public FlowInfo getFlowById(@PathVariable final String flowId, @RequestParam(name = "controller", required = false) boolean controller) throws AccessDeniedException {
LOGGER.info("Get flow by id. Flow id: '" + flowId + "'");
FlowInfo flowInfo = flowService.getFlowById(flowId, controller);
return flowInfo;
}
use of org.openkilda.auth.model.Permissions in project open-kilda by telstra.
the class RequestInterceptor method preHandle.
@Override
public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws AccessDeniedException {
String correlationId = request.getParameter(CORRELATION_ID);
correlationId = correlationId == null ? UUID.randomUUID().toString() : correlationId;
HttpSession session = request.getSession();
UserInfo userInfo = null;
if (IConstants.SessionTimeout.TIME_IN_MINUTE == null) {
IConstants.SessionTimeout.TIME_IN_MINUTE = Integer.valueOf(applicationSettingService.getApplicationSettings().get(ApplicationSetting.SESSION_TIMEOUT.name()));
}
session.setMaxInactiveInterval(IConstants.SessionTimeout.TIME_IN_MINUTE * 60);
userInfo = (UserInfo) session.getAttribute(IConstants.SESSION_OBJECT);
if (userInfo != null) {
validateUser(userInfo);
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
Permissions permissions = handlerMethod.getMethod().getAnnotation(Permissions.class);
if (permissions != null) {
validateAndPopulatePermisssion(userInfo, permissions);
}
}
updateRequestContext(correlationId, request, userInfo);
} else {
RequestContext requestContext = serverContext.getRequestContext();
requestContext.setCorrelationId(correlationId);
}
return true;
}
Aggregations