org.apache.shiro.util.ThreadState Java Examples
The following examples show how to use
org.apache.shiro.util.ThreadState.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContentAuthPluginScript.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override public Object run() { ThreadState threadState = new SubjectThreadState(subject); threadState.bind(); try { SourceLookup sourceLookup = getSourceLookup(); String format = (String) checkNotNull(sourceLookup.get(FORMAT)); String repositoryName = (String) checkNotNull(sourceLookup.get(REPOSITORY_NAME)); VariableResolverAdapter variableResolverAdapter = variableResolverAdapterManager.get(format); @SuppressWarnings("unchecked") List<Map<String, Object>> assets = (List<Map<String, Object>>) sourceLookup.getOrDefault("assets", Collections.emptyList()); if (assets != null && !assets.isEmpty()) { Map<String, Object> asset = assets.get(0); VariableSource variableSource = variableResolverAdapter.fromSourceLookup(sourceLookup, asset); Set<String> repoNames = new HashSet<>(); repoNames.add(repositoryName); repoNames.addAll(repositoryManager.findContainingGroups(repositoryName)); return contentPermissionChecker.isPermitted(repoNames, format, BROWSE, variableSource); } return false; } finally { threadState.clear(); if (contentAuthSleep) { try { TimeUnit.MILLISECONDS.sleep(1); } catch (InterruptedException e) { // NOSONAR: pooled ES thread log.error("Thread.sleep interruped", e); } } } }
Example #2
Source File: AbstractShiroTest.java From seed with Mozilla Public License 2.0 | 4 votes |
protected ThreadState createThreadState(Subject subject) { return new SubjectThreadState(subject); }
Example #3
Source File: AbstractShiroTest.java From gazpachoquest with GNU General Public License v3.0 | 4 votes |
protected ThreadState createThreadState(Subject subject) { return new SubjectThreadState(subject); }
Example #4
Source File: ShiroLogin.java From gazpachoquest with GNU General Public License v3.0 | 4 votes |
protected static ThreadState createThreadState(Subject subject) { return new SubjectThreadState(subject); }