org.sonatype.nexus.repository.security.VariableResolverAdapter Java Examples
The following examples show how to use
org.sonatype.nexus.repository.security.VariableResolverAdapter.
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: SearchResultComponentGeneratorSupport.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
protected String getPrivilegedRepositoryName(Map<String,Object> source) { String repositoryName = (String) source.get(REPOSITORY_NAME); String repositoryFormat = (String) source.get(FORMAT); List<Map<String, Object>> assets = (List<Map<String, Object>>) source.getOrDefault("assets", Collections.emptyList()); SourceLookup lookup = new SourceLookup(); lookup.setSource(source); if (assets != null && !assets.isEmpty()) { VariableResolverAdapter variableResolverAdapter = variableResolverAdapterManager.get(repositoryFormat); VariableSource variableSource = variableResolverAdapter.fromSourceLookup(lookup, assets.get(0)); List<String> repositoryNames = repositoryManager.findContainingGroups(repositoryName); repositoryNames.add(0, repositoryName); for (String name : repositoryNames) { if (contentPermissionChecker.isPermitted(name, repositoryFormat, BreadActions.BROWSE, variableSource)) { return name; } } } return null; }
Example #2
Source File: MavenUploadHandler.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Inject public MavenUploadHandler( final Maven2MavenPathParser parser, @Named(Maven2Format.NAME) final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker, final VersionPolicyValidator versionPolicyValidator, final MavenPomGenerator mavenPomGenerator, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(uploadDefinitionExtensions); this.parser = parser; this.variableResolverAdapter = variableResolverAdapter; this.contentPermissionChecker = contentPermissionChecker; this.versionPolicyValidator = versionPolicyValidator; this.mavenPomGenerator = mavenPomGenerator; }
Example #3
Source File: ExampleSecurityFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public ExampleSecurityFacet(final ExampleFormatSecurityContributor securityContributor, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityContributor, variableResolverAdapter, contentPermissionChecker); }
Example #4
Source File: PyPiSecurityFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public PyPiSecurityFacet(final PyPiFormatSecurityContributor securityContributor, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityContributor, variableResolverAdapter, contentPermissionChecker); }
Example #5
Source File: RawUploadHandler.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public RawUploadHandler(final ContentPermissionChecker contentPermissionChecker, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(contentPermissionChecker, variableResolverAdapter, uploadDefinitionExtensions); }
Example #6
Source File: RawUploadHandlerSupport.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
public RawUploadHandlerSupport( final ContentPermissionChecker contentPermissionChecker, final VariableResolverAdapter variableResolverAdapter, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(uploadDefinitionExtensions); this.contentPermissionChecker = contentPermissionChecker; this.variableResolverAdapter = variableResolverAdapter; }
Example #7
Source File: RawSecurityFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public RawSecurityFacet(final RawFormatSecurityContributor securityContributor, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityContributor, variableResolverAdapter, contentPermissionChecker); }
Example #8
Source File: ComposerSecurityFacet.java From nexus-repository-composer with Eclipse Public License 1.0 | 5 votes |
@Inject public ComposerSecurityFacet(final ComposerFormatSecurityContributor securityContributor, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityContributor, variableResolverAdapter, contentPermissionChecker); }
Example #9
Source File: RawUploadHandlerTest.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override protected UploadHandler newRawUploadHandler(final ContentPermissionChecker contentPermissionChecker, final VariableResolverAdapter variableResolverAdapter, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { return new RawUploadHandler(contentPermissionChecker, variableResolverAdapter, uploadDefinitionExtensions); }
Example #10
Source File: RawUploadHandlerTest.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override protected UploadHandler newRawUploadHandler(final ContentPermissionChecker contentPermissionChecker, final VariableResolverAdapter variableResolverAdapter, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { return new RawUploadHandler(contentPermissionChecker, variableResolverAdapter, uploadDefinitionExtensions); }
Example #11
Source File: GolangSecurityFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public GolangSecurityFacet(final GolangFormatSecurityContributor securityResource, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityResource, variableResolverAdapter, contentPermissionChecker); }
Example #12
Source File: RawUploadHandler.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public RawUploadHandler(final ContentPermissionChecker contentPermissionChecker, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(contentPermissionChecker, variableResolverAdapter, uploadDefinitionExtensions); }
Example #13
Source File: MavenSecurityFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public MavenSecurityFacet(final MavenFormatSecurityContributor securityContributor, @Named(Maven2Format.NAME) final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityContributor, variableResolverAdapter, contentPermissionChecker); }
Example #14
Source File: AptUploadHandler.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public AptUploadHandler(@Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(uploadDefinitionExtensions); this.variableResolverAdapter = variableResolverAdapter; this.contentPermissionChecker = contentPermissionChecker; }
Example #15
Source File: AptSecurityFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public AptSecurityFacet( final AptFormatSecurityContributor securityResource, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityResource, variableResolverAdapter, contentPermissionChecker); }
Example #16
Source File: CocoapodsSecurityFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public CocoapodsSecurityFacet(final CocoapodsFormatSecurityContributor securityResource, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityResource, variableResolverAdapter, contentPermissionChecker); }
Example #17
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 #18
Source File: VariableResolverAdapterManagerImplTest.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Before public void setUp() { Map<String, VariableResolverAdapter> adaptersByFormat = new HashMap<>(); adaptersByFormat.put("special", specializedAdapter); adaptersByFormat.put(VariableResolverAdapterManagerImpl.DEFAULT_ADAPTER_NAME, defaultAdapter); manager = new VariableResolverAdapterManagerImpl(adaptersByFormat); }
Example #19
Source File: RUploadHandler.java From nexus-repository-r with Eclipse Public License 1.0 | 5 votes |
@Inject public RUploadHandler(@Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(uploadDefinitionExtensions); this.variableResolverAdapter = variableResolverAdapter; this.contentPermissionChecker = contentPermissionChecker; }
Example #20
Source File: P2SecurityFacet.java From nexus-repository-p2 with Eclipse Public License 1.0 | 5 votes |
@Inject public P2SecurityFacet(final P2FormatSecurityContributor securityResource, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityResource, variableResolverAdapter, contentPermissionChecker); }
Example #21
Source File: HelmSecurityFacet.java From nexus-repository-helm with Eclipse Public License 1.0 | 5 votes |
@Inject public HelmSecurityFacet( final HelmFormatSecurityContributor securityResource, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityResource, variableResolverAdapter, contentPermissionChecker); }
Example #22
Source File: HelmUploadHandler.java From nexus-repository-helm with Eclipse Public License 1.0 | 5 votes |
@Inject public HelmUploadHandler( final ContentPermissionChecker contentPermissionChecker, final HelmAttributeParser helmPackageParser, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(uploadDefinitionExtensions); this.contentPermissionChecker = contentPermissionChecker; this.variableResolverAdapter = variableResolverAdapter; this.helmPackageParser = helmPackageParser; }
Example #23
Source File: RSecurityFacet.java From nexus-repository-r with Eclipse Public License 1.0 | 5 votes |
@Inject public RSecurityFacet(final RFormatSecurityContributor securityResource, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityResource, variableResolverAdapter, contentPermissionChecker); }
Example #24
Source File: ConanSecurityFacet.java From nexus-repository-conan with Eclipse Public License 1.0 | 5 votes |
@Inject public ConanSecurityFacet(final ConanFormatSecurityContributor securityResource, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityResource, variableResolverAdapter, contentPermissionChecker); }
Example #25
Source File: AptUploadHandler.java From nexus-repository-apt with Eclipse Public License 1.0 | 5 votes |
@Inject public AptUploadHandler(@Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(uploadDefinitionExtensions); this.variableResolverAdapter = variableResolverAdapter; this.contentPermissionChecker = contentPermissionChecker; }
Example #26
Source File: AptSecurityFacet.java From nexus-repository-apt with Eclipse Public License 1.0 | 5 votes |
@Inject public AptSecurityFacet( AptFormatSecurityContributor securityResource, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityResource, variableResolverAdapter, contentPermissionChecker); }
Example #27
Source File: OrientPyPiUploadHandler.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public OrientPyPiUploadHandler(final ContentPermissionChecker contentPermissionChecker, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(uploadDefinitionExtensions); this.contentPermissionChecker = contentPermissionChecker; this.variableResolverAdapter = variableResolverAdapter; }
Example #28
Source File: CondaSecurityFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public CondaSecurityFacet(final CondaFormatSecurityContributor securityResource, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityResource, variableResolverAdapter, contentPermissionChecker); }
Example #29
Source File: OrientNpmUploadHandler.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public OrientNpmUploadHandler(final ContentPermissionChecker contentPermissionChecker, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final NpmPackageParser npmPackageParser, final Set<UploadDefinitionExtension> uploadDefinitionExtensions) { super(uploadDefinitionExtensions); this.contentPermissionChecker = contentPermissionChecker; this.variableResolverAdapter = checkNotNull(variableResolverAdapter); this.npmPackageParser = checkNotNull(npmPackageParser); }
Example #30
Source File: NpmSecurityFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public NpmSecurityFacet(final NpmFormatSecurityContributor securityContributor, @Named("simple") final VariableResolverAdapter variableResolverAdapter, final ContentPermissionChecker contentPermissionChecker) { super(securityContributor, variableResolverAdapter, contentPermissionChecker); }