/** * Wrapper for ShiroUtils.getPrincipal(Subject, int) */ public Object getPrincipal(int index) { return ShiroUtils.getPrincipal(getSubject(), index); }
@Override @Path("{pathSegment}") public Object consumePathSegment(@PathParam("pathSegment") String pathSegment) { logger.debug("Publishing securityUtils in OGNL context"); OgnlContext ognlContext = ElementsThreadLocals.getOgnlContext(); ognlContext.put("securityUtils", new SecurityUtilsBean()); logger.debug("Publishing textProvider in OGNL context"); ognlContext.put("textProvider", new TextProviderBean(ElementsThreadLocals.getTextProvider())); FileObject child = children.get(pathSegment); if(child != null) { return consumePathSegment(pathSegment, child, resourceResolver); } return super.consumePathSegment(pathSegment); }
ognlContext.put("securityUtils", new SecurityUtilsBean());
@Override public void filter(ContainerRequestContext requestContext) { UriInfo uriInfo = requestContext.getUriInfo(); if(uriInfo.getMatchedResources().isEmpty()) { return; } Object resource = uriInfo.getMatchedResources().get(0); if(resourceInfo == null || resourceInfo.getResourceClass() == null) { return; } if(resource.getClass() != resourceInfo.getResourceClass()) { throw new RuntimeException("Inconsistency: matched resource is not of the right type, " + resourceInfo.getResourceClass()); } fillMDC(); logger.debug("Publishing securityUtils in OGNL context"); OgnlContext ognlContext = ElementsThreadLocals.getOgnlContext(); ognlContext.put("securityUtils", new SecurityUtilsBean()); if(resource instanceof PageAction) { PageAction pageAction = (PageAction) resource; pageAction.prepareForExecution(); } checkAuthorizations(requestContext, resource); accessLogger.info(requestContext.getMethod()); }
/** * Wrapper for ShiroUtils.getPrimaryPrincipal(Subject) */ public Object getPrimaryPrincipal() { return ShiroUtils.getPrimaryPrincipal(getSubject()); }
logger.debug("Publishing securityUtils in OGNL context"); OgnlContext ognlContext = ElementsThreadLocals.getOgnlContext(); ognlContext.put("securityUtils", new SecurityUtilsBean()); logger.debug("Publishing textProvider in OGNL context"); ognlContext.put("textProvider", new TextProviderBean(ElementsThreadLocals.getTextProvider()));
/** * Wrapper for ShiroUtils.getPrincipal(Subject, int) */ public Object getPrincipal(int index) { return ShiroUtils.getPrincipal(getSubject(), index); }
/** * Wrapper for ShiroUtils.getPrimaryPrincipal(Subject) */ public Object getPrimaryPrincipal() { return ShiroUtils.getPrimaryPrincipal(getSubject()); }
public Serializable getUserId() { return ShiroUtils.getUserId(getSubject()); }
public Serializable getUserId() { return ShiroUtils.getUserId(getSubject()); }