Package com.cloudbees.plugins.credentials.common

Examples of com.cloudbees.plugins.credentials.common.StandardCredentials


        }

        public SVNRepository openRepository(Job context, SCM scm, boolean keepConnection) throws SVNException {
            SVNURL repoURL = getSVNURL();

            StandardCredentials creds = lookupCredentials(context, credentialsId, repoURL);
            Map<String, Credentials> additional = new HashMap<String, Credentials>();
            if (creds == null) {
                // we should add additional credentials, this looks like it's going to be an external
                // TODO only necessary with externals, or can we always do this?
                List<AdditionalCredentials> additionalCredentialsList = ((SubversionSCM) scm).getAdditionalCredentials();
                for (AdditionalCredentials c : additionalCredentialsList) {
                    if (c.getCredentialsId() != null) {
                        StandardCredentials cred = CredentialsMatchers
                                .firstOrNull(CredentialsProvider.lookupCredentials(StandardCredentials.class, context,
                                        ACL.SYSTEM, Collections.<DomainRequirement>emptyList()),
                                        CredentialsMatchers.allOf(CredentialsMatchers.withId(c.getCredentialsId()),
                                                CredentialsMatchers.anyOf(CredentialsMatchers.instanceOf(
                                                        StandardCredentials.class), CredentialsMatchers.instanceOf(
View Full Code Here


              try {
                  String urlWithoutRevision = SvnHelper.getUrlWithoutRevision(url);

                  SVNURL repoURL = SVNURL.parseURIDecoded(urlWithoutRevision);

                  StandardCredentials credentials = lookupCredentials(context, value, repoURL);
                  if (descriptor().checkRepositoryPath(context,repoURL, credentials)!=SVNNodeKind.NONE) {
                      // something exists; now check revision if any

                      SVNRevision revision = getRevisionFromRemoteUrl(url);
                      if (revision != null && !revision.isValid()) {
View Full Code Here

        }

        /*package*/ StandardCredentials migrateCredentials(ModelObject context, String legacyRealm, Credential legacyCredential)
                throws IOException {
            CredentialsStore store = CredentialsProvider.lookupStores(context).iterator().next();
            StandardCredentials credential = legacyCredential.toCredentials(null, legacyRealm);
            if (credential != null) {
                return credential;
            }
            credential = legacyCredential.toCredentials(legacyRealm);
            if (store.isDomainsModifiable()) {
View Full Code Here

            if (!Hudson.getInstance().hasPermission(Hudson.ADMINISTER))
                return FormValidation.ok();

            try {
                SVNURL repoURL = SVNURL.parseURIDecoded(new EnvVars(EnvVars.masterEnvVars).expand(v));
                StandardCredentials credentials = lookupCredentials(context, credentialsId, repoURL);
                SVNNodeKind node = null;
                try {
                    node = checkRepositoryPath(context,repoURL, credentials);
                } catch (SVNCancelException ce) {
                    if (isAuthenticationFailedError(ce)) {
View Full Code Here

        this.provider = new RemotableSVNAuthenticationBuilderProvider(credentials,
                credentialsByRealm == null ? Collections.<String, Credentials>emptyMap() : credentialsByRealm);
    }

    public static CredentialsSVNAuthenticationProviderImpl createAuthenticationProvider(Item context, String remote, String credentialsId, Map<String,String> additionalCredentialIds) {
        StandardCredentials defaultCredentials;
        if (credentialsId == null) {
            defaultCredentials = null;
        } else {
            defaultCredentials = CredentialsMatchers
                    .firstOrNull(CredentialsProvider.lookupCredentials(StandardCredentials.class, context,
                            ACL.SYSTEM, URIRequirementBuilder.fromUri(remote).build()),
                            CredentialsMatchers.allOf(idMatcher(credentialsId),
                                    CredentialsMatchers.anyOf(CredentialsMatchers.instanceOf(
                                            StandardCredentials.class), CredentialsMatchers.instanceOf(
                                            SSHUserPrivateKey.class))));
        }
        Map<String, Credentials> additional = new HashMap<String, Credentials>();
        if (additionalCredentialIds != null) {
            for (Map.Entry<String,String> c : additionalCredentialIds.entrySet()) {
                if (c.getValue() != null) {
                    StandardCredentials cred = CredentialsMatchers
                            .firstOrNull(CredentialsProvider.lookupCredentials(StandardCredentials.class, context,
                                    ACL.SYSTEM, Collections.<DomainRequirement>emptyList()),
                                    CredentialsMatchers.allOf(idMatcher(c.getValue()),
                                            CredentialsMatchers.anyOf(CredentialsMatchers.instanceOf(
                                                    StandardCredentials.class), CredentialsMatchers.instanceOf(
View Full Code Here

    }

    public static CredentialsSVNAuthenticationProviderImpl createAuthenticationProvider(Item context, SubversionSCM scm,
                                                                                        SubversionSCM.ModuleLocation
                                                                                                location) {
        StandardCredentials defaultCredentials;
        if (location == null) {
            defaultCredentials = null;
        } else {
            defaultCredentials = CredentialsMatchers
                    .firstOrNull(CredentialsProvider.lookupCredentials(StandardCredentials.class, context,
                            ACL.SYSTEM, URIRequirementBuilder.fromUri(location.remote).build()),
                            CredentialsMatchers.allOf(idMatcher(location.credentialsId),
                                    CredentialsMatchers.anyOf(CredentialsMatchers.instanceOf(
                                            StandardCredentials.class), CredentialsMatchers.instanceOf(
                                            SSHUserPrivateKey.class))));
        }
        Map<String, Credentials> additional = new HashMap<String, Credentials>();
        if (scm != null) {
            for (SubversionSCM.AdditionalCredentials c : scm.getAdditionalCredentials()) {
                if (c.getCredentialsId() != null) {
                    StandardCredentials cred = CredentialsMatchers
                            .firstOrNull(CredentialsProvider.lookupCredentials(StandardCredentials.class, context,
                                    ACL.SYSTEM, Collections.<DomainRequirement>emptyList()),
                                    CredentialsMatchers.allOf(idMatcher(c.getCredentialsId()),
                                            CredentialsMatchers.anyOf(CredentialsMatchers.instanceOf(
                                                    StandardCredentials.class), CredentialsMatchers.instanceOf(
View Full Code Here

                continue; // when tags.size()==1, UI won't show the checkbox.
            newTags.put(e,parser.get("name" + i));
        }

        String credentialsId = parser.get("credentialsId");
        StandardCredentials upc = null;
        if (credentialsId != null) {
            Item context = req.findAncestorObject(Item.class);
            final List<Authentication> authentications = new ArrayList<Authentication>(2);
            authentications.add(Jenkins.getAuthentication());
            if (context.hasPermission(Item.CONFIGURE)) {
View Full Code Here

            try {
                String urlWithoutRevision = SvnHelper.getUrlWithoutRevision(url);

                SVNURL repoURL = SVNURL.parseURIDecoded(urlWithoutRevision);

                StandardCredentials credentials = value == null ? null :
                        CredentialsMatchers.firstOrNull(CredentialsProvider
                                .lookupCredentials(StandardCredentials.class, context, ACL.SYSTEM,
                                        URIRequirementBuilder.fromUri(repoURL.toString()).build()),
                                CredentialsMatchers.withId(value));
                if (checkRepositoryPath(context, repoURL, credentials)!=SVNNodeKind.NONE) {
View Full Code Here

TOP

Related Classes of com.cloudbees.plugins.credentials.common.StandardCredentials

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.