/** * {@inheritDoc} */ @Override public String getIconClassName() { return store.getProvider().getIconClassName(); }
/** * {@inheritDoc} */ @Override public String getIconClassName() { return store.getProvider().getIconClassName(); }
/** * Exposes the description of this store (i.e. the {@link CredentialsProvider#getDisplayName()}. * * @return the description of this store (i.e. the {@link CredentialsProvider#getDisplayName()}. */ public String getDescription() { return store.getProvider().getDisplayName(); }
/** * Exposes the description of this store (i.e. the {@link CredentialsProvider#getDisplayName()}. * * @return the description of this store (i.e. the {@link CredentialsProvider#getDisplayName()}. */ public String getDescription() { return store.getProvider().getDisplayName(); }
/** * {@inheritDoc} */ @Override public String getIconClassName() { return store.getProvider().getIconClassName(); }
/** * Exposes the description of this store (i.e. the {@link CredentialsProvider#getDisplayName()}. * * @return the description of this store (i.e. the {@link CredentialsProvider#getDisplayName()}. */ public String getDescription() { return store.getProvider().getDisplayName(); }
/** * {@inheritDoc} */ @Override public String getIconClassName() { return store.getProvider().getIconClassName(); }
/** * Exposes the description of this store (i.e. the {@link CredentialsProvider#getDisplayName()}. * * @return the description of this store (i.e. the {@link CredentialsProvider#getDisplayName()}. */ public String getDescription() { return store.getProvider().getDisplayName(); }
/** * Returns the {@link CredentialsProvider} or dies trying. * * @return the {@link CredentialsProvider} * @since 2.0 */ @NonNull public final CredentialsProvider getProviderOrDie() { CredentialsProvider provider = getProvider(); if (provider == null) { // we can only construct an instance if we were given the providerClass or we successfully inferred it // thus if the provider is missing it must have been removed from the extension list, e.g. by an admin // that wanted to block that provider from users before the addition of provider visibility controls throw new IllegalStateException("The credentials provider " + providerClass + " has been removed from the list of active extension points"); } return provider; }
/** * Returns the {@link CredentialsProvider} or dies trying. * * @return the {@link CredentialsProvider} * @since 2.0 */ @NonNull public final CredentialsProvider getProviderOrDie() { CredentialsProvider provider = getProvider(); if (provider == null) { // we can only construct an instance if we were given the providerClass or we successfully inferred it // thus if the provider is missing it must have been removed from the extension list, e.g. by an admin // that wanted to block that provider from users before the addition of provider visibility controls throw new IllegalStateException("The credentials provider " + providerClass + " has been removed from the list of active extension points"); } return provider; }
/** * Returns the {@link CredentialsScope} instances that are applicable to this store. * @return the {@link CredentialsScope} instances that are applicable to this store or {@code null} if the store * instance is no longer enabled. * * @since 2.1.5 */ @Nullable public final Set<CredentialsScope> getScopes() { CredentialsProvider provider = getProvider(); return provider == null ? null : provider.getScopes(getContext()); }
/** * Returns the {@link CredentialsScope} instances that are applicable to this store. * @return the {@link CredentialsScope} instances that are applicable to this store or {@code null} if the store * instance is no longer enabled. * * @since 2.1.5 */ @Nullable public final Set<CredentialsScope> getScopes() { CredentialsProvider provider = getProvider(); return provider == null ? null : provider.getScopes(getContext()); }
/** * Returns the list of {@link CredentialsDescriptor} instances that are applicable within this * {@link CredentialsStore}. * * @return the list of {@link CredentialsDescriptor} instances that are applicable within this * {@link CredentialsStore}. * @since 2.0 */ public final List<CredentialsDescriptor> getCredentialsDescriptors() { CredentialsProvider provider = getProvider(); List<CredentialsDescriptor> result = DescriptorVisibilityFilter.apply(this, ExtensionList.lookup(CredentialsDescriptor.class)); if (provider != null && provider.isEnabled()) { if (!(result instanceof ArrayList)) { // should never happen, but let's be defensive in case the DescriptorVisibilityFilter contract changes result = new ArrayList<CredentialsDescriptor>(result); } for (Iterator<CredentialsDescriptor> iterator = result.iterator(); iterator.hasNext(); ) { CredentialsDescriptor d = iterator.next(); if (!_isApplicable(d) || !provider._isApplicable(d) || !d.isApplicable(provider)) { iterator.remove(); } } } return result; }
/** * Constructor. * * @param store the store. */ public StoreItem(CredentialsStore store) { this.store = store; String provider = store.getProvider().getClass().getName(); String resolver = null; String token = null; ModelObject storeContext = store.getContext(); // we only support the cases where the for (ContextResolver r : ExtensionList.lookup(ContextResolver.class)) { String t = r.getToken(storeContext); if (t != null) { resolver = r.getClass().getName(); token = t; break; } } this.url = token == null ? null : String.format( "descriptor/%s/resolver/%s/provider/%s/context/%s", CredentialsSelectHelper.class.getName(), Util.rawEncode(resolver), Util.rawEncode(provider), Util.rawEncode(token) ); }
/** * Determines if the specified {@link Descriptor} is applicable to this {@link CredentialsStore}. * <p> * The default implementation consults the {@link DescriptorVisibilityFilter}s, {@link #_isApplicable(Descriptor)} * and the {@link #getProviderOrDie()}. * * @param descriptor the {@link Descriptor} to check. * @return {@code true} if the supplied {@link Descriptor} is applicable in this {@link CredentialsStore} * @since 2.0 */ public final boolean isApplicable(Descriptor<?> descriptor) { for (DescriptorVisibilityFilter filter : DescriptorVisibilityFilter.all()) { if (!filter.filter(this, descriptor)) { return false; } } CredentialsProvider provider = getProvider(); return _isApplicable(descriptor) && (provider == null || provider.isApplicable(descriptor)); }
private CredentialsStore getFolderStore(Folder f) { Iterable<CredentialsStore> stores = CredentialsProvider.lookupStores(f); CredentialsStore folderStore = null; for (CredentialsStore s : stores) { if (s.getProvider() instanceof FolderCredentialsProvider && s.getContext() == f) { folderStore = s; break; } } return folderStore; }
/** * Checks if this action should be visible. * * @return {@code true} if the action should be visible. */ public boolean isVisible() { CredentialsStore store = getStore(); if (!store.getProvider().isEnabled()) { return false; } CredentialsStoreAction storeAction = store.getStoreAction(); if (storeAction != null && this != storeAction) { // 2.0+ implementations of CredentialsStore should be returning their action via getStoreAction() // and we want to display that action from ViewCredentialsAction // Old implementations will be returning null from getStoreAction() so we let them display as before // Forward looking implementations written against the old API will want to "hide" their old // action and display the new one returned from getStoreAction() which is what this hook enables. return false; } return store.hasPermission(CredentialsProvider.VIEW) && !store.getCredentialsDescriptors().isEmpty(); }
/** * Checks if this action should be visible. * * @return {@code true} if the action should be visible. */ public boolean isVisible() { CredentialsStore store = getStore(); if (!store.getProvider().isEnabled()) { return false; } CredentialsStoreAction storeAction = store.getStoreAction(); if (storeAction != null && this != storeAction) { // 2.0+ implementations of CredentialsStore should be returning their action via getStoreAction() // and we want to display that action from ViewCredentialsAction // Old implementations will be returning null from getStoreAction() so we let them display as before // Forward looking implementations written against the old API will want to "hide" their old // action and display the new one returned from getStoreAction() which is what this hook enables. return false; } return store.hasPermission(CredentialsProvider.VIEW) && !store.getCredentialsDescriptors().isEmpty(); }
private CredentialsStore getFolderStore(Folder f) { Iterable<CredentialsStore> stores = CredentialsProvider.lookupStores(f); CredentialsStore folderStore = null; for (CredentialsStore s : stores) { if (s.getProvider() instanceof FolderCredentialsProvider && s.getContext() == f) { folderStore = s; break; } } return folderStore; }
/** * Determines if the specified {@link Descriptor} is applicable to this {@link CredentialsStore}. * <p> * The default implementation consults the {@link DescriptorVisibilityFilter}s, {@link #_isApplicable(Descriptor)} * and the {@link #getProviderOrDie()}. * * @param descriptor the {@link Descriptor} to check. * @return {@code true} if the supplied {@link Descriptor} is applicable in this {@link CredentialsStore} * @since 2.0 */ public final boolean isApplicable(Descriptor<?> descriptor) { for (DescriptorVisibilityFilter filter : DescriptorVisibilityFilter.all()) { if (!filter.filter(this, descriptor)) { return false; } } CredentialsProvider provider = getProvider(); return _isApplicable(descriptor) && (provider == null || provider.isApplicable(descriptor)); }