Skip to content

Conversation

@jglick
Copy link
Member

@jglick jglick commented Aug 7, 2025

#56 seems to have broken form validation for http-protocol URLs. The message gave no details. Also after fixing this, there was no visual indication that a successful check had been run.

@cashlalala cashlalala merged commit cebfafc into jenkinsci:master Aug 8, 2025
15 checks passed
@jglick jglick deleted the doCheckAddress branch August 8, 2025 11:23
@jglick
Copy link
Member Author

jglick commented Aug 8, 2025

Not sure I have time for it now, but I noticed that the form validation does not check authn; https://jenkins/whoAmI/api/json?tree=name should return a 200 response if authentication is correct. This is possible but would require some refactoring to share code with doCheckAddress:

diff --git src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/auth2/TokenAuth.java src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/auth2/TokenAuth.java
index 1b265af..d176297 100644
--- src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/auth2/TokenAuth.java
+++ src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/auth2/TokenAuth.java
@@ -12,8 +12,11 @@ import org.kohsuke.stapler.DataBoundConstructor;
 import org.kohsuke.stapler.DataBoundSetter;
 
 import hudson.Extension;
+import hudson.RelativePath;
 import hudson.model.Item;
+import hudson.util.FormValidation;
 import hudson.util.Secret;
+import org.kohsuke.stapler.QueryParameter;
 
 public class TokenAuth extends Auth2 {
 
@@ -76,6 +79,10 @@ public class TokenAuth extends Auth2 {
         public String getDisplayName() {
             return "Token Authentication";
         }
+
+        public FormValidation doCheckApiToken(@RelativePath("..") @QueryParameter String address, @QueryParameter String userName, @QueryParameter String apiToken) {
+            return FormValidation.ok("Example: address=" + address + " userName=" + userName + " apiToken=" + apiToken);
+        }
     }
 
     @Override

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants