-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom parameters to authorize and logout endpoints #480
Open
eva-mueller-coremedia
wants to merge
15
commits into
jenkinsci:master
Choose a base branch
from
eva-mueller-coremedia:query-params
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6d990c4
Fix Javadoc
eva-mueller-coremedia cf6307f
Fix typos
eva-mueller-coremedia 4da425c
Remove unused method
eva-mueller-coremedia 4107d5a
Do not access static member compileJMESPath via instance reference
eva-mueller-coremedia 9fd1866
Fix typo
eva-mueller-coremedia df31734
Remove duplicate check
eva-mueller-coremedia 1a406c1
Remove unnecessary return statement in 'void' method
eva-mueller-coremedia b0a515f
Condition 'field != null' already covered by subsequent condition 'fi…
eva-mueller-coremedia a3f1467
Simplify statement
eva-mueller-coremedia 8884688
Remove superfluous log statement
eva-mueller-coremedia 877f8b1
Simplify check if map contains key
eva-mueller-coremedia c62804f
Fix JCasC configuration reference
eva-mueller-coremedia ae4a2b0
Add custom parameters to authorize and logout endpoint
eva-mueller-coremedia 4e5ab83
Fix FormValidation check when overwriting scopes
eva-mueller-coremedia bf28327
Extend test for OicServerManualConfigurationTest
eva-mueller-coremedia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 84 additions & 0 deletions
84
src/main/java/org/jenkinsci/plugins/oic/OicQueryParameterConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package org.jenkinsci.plugins.oic; | ||
|
||
import hudson.Extension; | ||
import hudson.Util; | ||
import hudson.model.AbstractDescribableImpl; | ||
import hudson.model.Descriptor; | ||
import hudson.util.FormValidation; | ||
import java.io.Serializable; | ||
import java.net.URLEncoder; | ||
import java.nio.charset.StandardCharsets; | ||
import jenkins.model.Jenkins; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.kohsuke.stapler.DataBoundSetter; | ||
import org.kohsuke.stapler.QueryParameter; | ||
import org.kohsuke.stapler.verb.POST; | ||
import org.springframework.lang.NonNull; | ||
|
||
public class OicQueryParameterConfiguration extends AbstractDescribableImpl<OicQueryParameterConfiguration> | ||
implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private String paramName; | ||
private String paramValue; | ||
|
||
@DataBoundConstructor | ||
public OicQueryParameterConfiguration() {} | ||
|
||
public OicQueryParameterConfiguration(@NonNull String paramName, @NonNull String paramValue) { | ||
if (Util.fixEmptyAndTrim(paramName) == null) { | ||
throw new IllegalStateException("Parameter name '" + paramName + "' must not be null or empty."); | ||
} | ||
setQueryParamName(paramName.trim()); | ||
setQueryParamValue(paramValue.trim()); | ||
} | ||
|
||
@DataBoundSetter | ||
public void setQueryParamName(String paramName) { | ||
this.paramName = paramName; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setQueryParamValue(String paramValue) { | ||
this.paramValue = paramValue; | ||
} | ||
|
||
public String getQueryParamName() { | ||
return paramName; | ||
} | ||
|
||
public String getQueryParamValue() { | ||
return paramValue; | ||
} | ||
|
||
public String getQueryParamNameDecoded() { | ||
return paramName != null | ||
? URLEncoder.encode(paramName, StandardCharsets.UTF_8).trim() | ||
: null; | ||
} | ||
|
||
public String getQueryParamValueDecoded() { | ||
return paramValue != null | ||
? URLEncoder.encode(paramValue, StandardCharsets.UTF_8).trim() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this appears to be encoding not decoding? |
||
: null; | ||
} | ||
|
||
@Extension | ||
public static final class DescriptorImpl extends Descriptor<OicQueryParameterConfiguration> { | ||
@NonNull | ||
@Override | ||
public String getDisplayName() { | ||
return "Query Parameter Configuration"; | ||
} | ||
|
||
@POST | ||
public FormValidation doCheckQueryParamName(@QueryParameter String queryParamName) { | ||
Jenkins.get().checkPermission(Jenkins.ADMINISTER); | ||
if (Util.fixEmptyAndTrim(queryParamName) == null) { | ||
return FormValidation.error(Messages.OicQueryParameterConfiguration_QueryParameterNameRequired()); | ||
} | ||
return FormValidation.ok(); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this appears to be encoding not decoding?