forked from benmccann/jenkins-saml-plugin
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Upgrade to pac4j 6.x, require Java 17 or newer, and migrate to EE 9 #446
Merged
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env groovy | ||
|
||
buildPlugin(useContainerAgent: true, configurations: [ | ||
buildPlugin(useContainerAgent: false, configurations: [ | ||
[platform: 'linux', jdk: 21], | ||
[platform: 'windows', jdk: 17], | ||
]) |
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
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
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
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 |
---|---|---|
|
@@ -18,12 +18,14 @@ | |
package org.jenkinsci.plugins.saml; | ||
|
||
import java.util.logging.Logger; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
import org.kohsuke.stapler.StaplerResponse; | ||
import org.kohsuke.stapler.StaplerRequest2; | ||
import org.kohsuke.stapler.StaplerResponse2; | ||
import org.pac4j.core.context.CallContext; | ||
import org.pac4j.core.context.WebContext; | ||
import org.pac4j.jee.context.session.JEESessionStore; | ||
import org.pac4j.core.context.session.SessionStore; | ||
import org.pac4j.core.exception.http.HttpAction; | ||
import org.pac4j.saml.client.SAML2Client; | ||
import org.pac4j.saml.credentials.SAML2AuthenticationCredentials; | ||
import org.pac4j.saml.credentials.SAML2Credentials; | ||
import org.pac4j.saml.exceptions.SAMLException; | ||
import org.pac4j.saml.profile.SAML2Profile; | ||
|
@@ -36,7 +38,7 @@ public class SamlProfileWrapper extends OpenSAMLWrapper<SAML2Profile> { | |
private static final Logger LOG = Logger.getLogger(SamlProfileWrapper.class.getName()); | ||
|
||
|
||
public SamlProfileWrapper(SamlPluginConfig samlPluginConfig, StaplerRequest request, StaplerResponse response) { | ||
public SamlProfileWrapper(SamlPluginConfig samlPluginConfig, StaplerRequest2 request, StaplerResponse2 response) { | ||
this.request = request; | ||
this.response = response; | ||
this.samlPluginConfig = samlPluginConfig; | ||
|
@@ -48,13 +50,16 @@ public SamlProfileWrapper(SamlPluginConfig samlPluginConfig, StaplerRequest requ | |
@SuppressWarnings("unused") | ||
@Override | ||
protected SAML2Profile process() { | ||
SAML2Credentials credentials; | ||
SAML2AuthenticationCredentials credentials; | ||
SAML2Profile saml2Profile; | ||
try { | ||
SAML2Client client = createSAML2Client(); | ||
WebContext context = createWebContext(); | ||
credentials = (SAML2Credentials) client.getCredentials(context, JEESessionStore.INSTANCE).orElse(null); | ||
saml2Profile = (SAML2Profile) client.getUserProfile(credentials, context, JEESessionStore.INSTANCE).orElse(null); | ||
SessionStore sessionStore = createSessionStore(); | ||
CallContext ctx = new CallContext(context, sessionStore); | ||
SAML2Credentials unvalidated = (SAML2Credentials) client.getCredentials(ctx).orElse(null); | ||
credentials = (SAML2AuthenticationCredentials) client.validateCredentials(ctx, unvalidated).orElse(null); | ||
Comment on lines
+60
to
+61
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. Per the migration guide, the |
||
saml2Profile = (SAML2Profile) client.getUserProfile(ctx, credentials).orElse(null); | ||
client.destroy(); | ||
} catch (HttpAction|SAMLException e) { | ||
//if the SAMLResponse is not valid we send the user again to the IdP | ||
|
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
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
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.
To run
LiveTest
on CI builds.