Hi Jesse, Gavin,

Both thanks for your input. With kudos to Jesse we now have the 
authentication at folder context working. We adjusted our code and did an 
initial test. Coming days I will continue more testing, but for now this 
look better during the first local tests.

That great community support.  Some snippet for the internet archive ;)

@Nullable
public static StandardUsernamePasswordCredentials 
findCredentialsById(String credentialsId, Run<?,?> run) {
        if (StringUtils.isBlank(credentialsId)) {
            return null;
        }
        return
            CredentialsProvider.findCredentialById(credentialsId, 
StandardUsernamePasswordCredentials.class, run,
                Collections.emptyList());
    }

Additional this Community question/answer also helped.  
https://community.jenkins.io/t/what-does-mean-to-support-folder-scope-credentials/2202/3
 



On Monday, 31 October 2022 at 13:55:20 UTC+1 jgl...@cloudbees.com wrote:

> I suspect you wanted 
> https://javadoc.jenkins.io/plugin/credentials/com/cloudbees/plugins/credentials/CredentialsProvider.html#findCredentialById(java.lang.String,java.lang.Class,hudson.model.Run,com.cloudbees.plugins.credentials.domains.DomainRequirement...)
>  
> which should take into account the folder context.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/0d0e0c0f-b766-48a9-bb17-723a3912becan%40googlegroups.com.

Reply via email to