Codota Logo
DelegatingSecurityContextRunnable
Code IndexAdd Codota to your IDE (free)

How to use
DelegatingSecurityContextRunnable
in
org.springframework.security.concurrent

Best Java code snippets using org.springframework.security.concurrent.DelegatingSecurityContextRunnable (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-security

  /**
   * Factory method for creating a {@link DelegatingSecurityContextRunnable}.
   *
   * @param delegate the original {@link Runnable} that will be delegated to after
   * establishing a {@link SecurityContext} on the {@link SecurityContextHolder}. Cannot
   * have null.
   * @param securityContext the {@link SecurityContext} to establish before invoking the
   * delegate {@link Runnable}. If null, the current {@link SecurityContext} from the
   * {@link SecurityContextHolder} will be used.
   * @return
   */
  public static Runnable create(Runnable delegate, SecurityContext securityContext) {
    Assert.notNull(delegate, "delegate cannot be  null");
    return securityContext == null ? new DelegatingSecurityContextRunnable(delegate)
        : new DelegatingSecurityContextRunnable(delegate, securityContext);
  }
}
origin: spring-projects/spring-security

protected final Runnable wrap(Runnable delegate) {
  return DelegatingSecurityContextRunnable.create(delegate, securityContext);
}
origin: org.springframework.security/spring-security-core

  /**
   * Factory method for creating a {@link DelegatingSecurityContextRunnable}.
   *
   * @param delegate the original {@link Runnable} that will be delegated to after
   * establishing a {@link SecurityContext} on the {@link SecurityContextHolder}. Cannot
   * have null.
   * @param securityContext the {@link SecurityContext} to establish before invoking the
   * delegate {@link Runnable}. If null, the current {@link SecurityContext} from the
   * {@link SecurityContextHolder} will be used.
   * @return
   */
  public static Runnable create(Runnable delegate, SecurityContext securityContext) {
    Assert.notNull(delegate, "delegate cannot be  null");
    return securityContext == null ? new DelegatingSecurityContextRunnable(delegate)
        : new DelegatingSecurityContextRunnable(delegate, securityContext);
  }
}
origin: org.springframework.security/spring-security-core

protected final Runnable wrap(Runnable delegate) {
  return DelegatingSecurityContextRunnable.create(delegate, securityContext);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorNullDelegate() {
  new DelegatingSecurityContextRunnable(null);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void createNullDelegateAndSecurityContext() {
  DelegatingSecurityContextRunnable.create(null, null);
}
origin: spring-projects/spring-security

@Test
public void toStringDelegates() {
  runnable = new DelegatingSecurityContextRunnable(delegate, securityContext);
  assertThat(runnable.toString()).isEqualTo(delegate.toString());
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void createNullDelegateAndSecurityContext() {
  DelegatingSecurityContextRunnable.create(null, null);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorNullDelegateNonNullSecurityContext() {
  new DelegatingSecurityContextRunnable(null, securityContext);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void createNullDelegate() {
  DelegatingSecurityContextRunnable.create(null, securityContext);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorNullSecurityContext() {
  new DelegatingSecurityContextRunnable(delegate, null);
}
origin: spring-projects/spring-security

@Test
public void create() throws Exception {
  runnable = DelegatingSecurityContextRunnable.create(delegate, securityContext);
  assertWrapped(runnable);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorNullDelegateAndSecurityContext() {
  new DelegatingSecurityContextRunnable(null, null);
}
origin: spring-projects/spring-security

@Test
public void createNullSecurityContext() throws Exception {
  SecurityContextHolder.setContext(securityContext);
  runnable = DelegatingSecurityContextRunnable.create(delegate, null);
  SecurityContextHolder.clearContext(); // ensure runnable is what sets up the
                      // SecurityContextHolder
  assertWrapped(runnable);
}
origin: spring-projects/spring-security

@Test
public void call() throws Exception {
  runnable = new DelegatingSecurityContextRunnable(delegate, securityContext);
  assertWrapped(runnable);
}
origin: apache/servicemix-bundles

protected final Runnable wrap(Runnable delegate) {
  return DelegatingSecurityContextRunnable.create(delegate, securityContext);
}
origin: spring-projects/spring-security

@Test
public void callDefaultSecurityContext() throws Exception {
  SecurityContextHolder.setContext(securityContext);
  runnable = new DelegatingSecurityContextRunnable(delegate);
  SecurityContextHolder.clearContext(); // ensure runnable is what sets up the
                      // SecurityContextHolder
  assertWrapped(runnable);
}
origin: spring-projects/spring-security

@Test
public void callOnSameThread() throws Exception {
  originalSecurityContext = securityContext;
  SecurityContextHolder.setContext(originalSecurityContext);
  executor = synchronousExecutor();
  runnable = new DelegatingSecurityContextRunnable(delegate,
      securityContext);
  assertWrapped(runnable);
}
origin: apache/servicemix-bundles

  /**
   * Factory method for creating a {@link DelegatingSecurityContextRunnable}.
   *
   * @param delegate the original {@link Runnable} that will be delegated to after
   * establishing a {@link SecurityContext} on the {@link SecurityContextHolder}. Cannot
   * have null.
   * @param securityContext the {@link SecurityContext} to establish before invoking the
   * delegate {@link Runnable}. If null, the current {@link SecurityContext} from the
   * {@link SecurityContextHolder} will be used.
   * @return
   */
  public static Runnable create(Runnable delegate, SecurityContext securityContext) {
    Assert.notNull(delegate, "delegate cannot be  null");
    return securityContext == null ? new DelegatingSecurityContextRunnable(delegate)
        : new DelegatingSecurityContextRunnable(delegate, securityContext);
  }
}
origin: stackoverflow.com

 public void authorizedExecute(Runnable runnable) {
  new Thread(new DelegatingSecurityContextRunnable(runnable)).start();
}
org.springframework.security.concurrentDelegatingSecurityContextRunnable

Javadoc

Wraps a delegate Runnable with logic for setting up a SecurityContextbefore invoking the delegate Runnable and then removing the SecurityContext after the delegate has completed.

If there is a SecurityContext that already exists, it will be restored after the #run() method is invoked.

Most used methods

  • <init>
    Creates a new DelegatingSecurityContextRunnable with a specific SecurityContext.
  • create
    Factory method for creating a DelegatingSecurityContextRunnable.

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getExternalFilesDir (Context)
  • putExtra (Intent)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now