|
47 | 47 | import edu.umd.cs.findbugs.annotations.NonNull;
|
48 | 48 | import jenkins.model.Jenkins;
|
49 | 49 | import jenkins.model.queue.AsynchronousExecution;
|
50 |
| -import org.acegisecurity.Authentication; |
51 | 50 | import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException;
|
52 | 51 | import org.kohsuke.accmod.Restricted;
|
53 | 52 | import org.kohsuke.accmod.restrictions.NoExternalUse;
|
| 53 | +import org.springframework.security.core.Authentication; |
54 | 54 |
|
55 | 55 | /**
|
56 | 56 | * State of a currently executing workflow.
|
@@ -248,10 +248,27 @@ public boolean blocksRestart() {
|
248 | 248 | * Looks up authentication associated with this flow execution.
|
249 | 249 | * For example, if a flow is configured to be a trusted agent of a user, that would be set here.
|
250 | 250 | * A flow run triggered by a user manually might be associated with the runtime, or it might not.
|
251 |
| - * @return an authentication; {@link ACL#SYSTEM} as a fallback, or {@link Jenkins#ANONYMOUS} if the flow is supposed to be limited to a specific user but that user cannot now be looked up |
| 251 | + * @return an authentication; {@link ACL#SYSTEM2} as a fallback, or {@link Jenkins#ANONYMOUS2} if the flow is supposed to be limited to a specific user but that user cannot now be looked up |
252 | 252 | */
|
253 |
| - public abstract @NonNull Authentication getAuthentication(); |
| 253 | + public /* abstract */ @NonNull Authentication getAuthentication2() { |
| 254 | + return Util.ifOverridden( |
| 255 | + () -> getAuthentication().toSpring(), |
| 256 | + org.acegisecurity.Authentication.class, |
| 257 | + getClass(), |
| 258 | + "getAuthentication"); |
| 259 | + } |
254 | 260 |
|
| 261 | + /** |
| 262 | + * @deprecated use {@link #getAuthentication2()} |
| 263 | + */ |
| 264 | + @Deprecated |
| 265 | + public /* abstract */ @NonNull org.acegisecurity.Authentication getAuthentication() { |
| 266 | + return Util.ifOverridden( |
| 267 | + () -> org.acegisecurity.Authentication.fromSpring(getAuthentication2()), |
| 268 | + Authentication.class, |
| 269 | + getClass(), |
| 270 | + "getAuthentication2"); |
| 271 | + } |
255 | 272 |
|
256 | 273 | /** @see GraphLookupView#isActive(FlowNode)
|
257 | 274 | * @throws IllegalArgumentException If the input {@link FlowNode} does not belong to this execution
|
|
0 commit comments