Tabnine Logo
JaasAuthenticationProvider.afterPropertiesSet
Code IndexAdd Tabnine to your IDE (free)

How to use
afterPropertiesSet
method
in
org.springframework.security.authentication.jaas.JaasAuthenticationProvider

Best Java code snippets using org.springframework.security.authentication.jaas.JaasAuthenticationProvider.afterPropertiesSet (Showing top 5 results out of 315)

origin: spring-projects/spring-security

@Test
public void spacesInLoginConfigPathAreAccepted() throws Exception {
  File configFile;
  // Create temp directory with a space in the name
  File configDir = new File(System.getProperty("java.io.tmpdir") + File.separator
      + "jaas test");
  configDir.deleteOnExit();
  if (configDir.exists()) {
    configDir.delete();
  }
  configDir.mkdir();
  configFile = File.createTempFile("login", "conf", configDir);
  configFile.deleteOnExit();
  FileOutputStream fos = new FileOutputStream(configFile);
  PrintWriter pw = new PrintWriter(fos);
  pw.append("JAASTestBlah {"
      + "org.springframework.security.authentication.jaas.TestLoginModule required;"
      + "};");
  pw.flush();
  pw.close();
  JaasAuthenticationProvider myJaasProvider = new JaasAuthenticationProvider();
  myJaasProvider.setApplicationEventPublisher(context);
  myJaasProvider.setLoginConfig(new FileSystemResource(configFile));
  myJaasProvider.setAuthorityGranters(jaasProvider.getAuthorityGranters());
  myJaasProvider.setCallbackHandlers(jaasProvider.getCallbackHandlers());
  myJaasProvider.setLoginContextName(jaasProvider.getLoginContextName());
  myJaasProvider.afterPropertiesSet();
}
origin: spring-projects/spring-security

@Test
public void detectsMissingLoginConfig() throws Exception {
  JaasAuthenticationProvider myJaasProvider = new JaasAuthenticationProvider();
  myJaasProvider.setApplicationEventPublisher(context);
  myJaasProvider.setAuthorityGranters(jaasProvider.getAuthorityGranters());
  myJaasProvider.setCallbackHandlers(jaasProvider.getCallbackHandlers());
  myJaasProvider.setLoginContextName(jaasProvider.getLoginContextName());
  try {
    myJaasProvider.afterPropertiesSet();
    fail("Should have thrown ApplicationContextException");
  }
  catch (IllegalArgumentException expected) {
    assertThat(expected.getMessage().startsWith("loginConfig must be set on")).isTrue();
  }
}
origin: spring-projects/spring-security

@Test
public void detectsMissingLoginContextName() throws Exception {
  JaasAuthenticationProvider myJaasProvider = new JaasAuthenticationProvider();
  myJaasProvider.setApplicationEventPublisher(context);
  myJaasProvider.setAuthorityGranters(jaasProvider.getAuthorityGranters());
  myJaasProvider.setCallbackHandlers(jaasProvider.getCallbackHandlers());
  myJaasProvider.setLoginConfig(jaasProvider.getLoginConfig());
  myJaasProvider.setLoginContextName(null);
  try {
    myJaasProvider.afterPropertiesSet();
    fail("Should have thrown IllegalArgumentException");
  }
  catch (IllegalArgumentException expected) {
    assertThat(expected.getMessage()).startsWith("loginContextName must be set on");
  }
  myJaasProvider.setLoginContextName("");
  try {
    myJaasProvider.afterPropertiesSet();
    fail("Should have thrown IllegalArgumentException");
  }
  catch (IllegalArgumentException expected) {
    assertThat(expected.getMessage().startsWith("loginContextName must be set on"));
  }
}
origin: spring-projects/spring-security

private void testConfigureJaasCase(JaasAuthenticationProvider p1,
    JaasAuthenticationProvider p2) throws Exception {
  p1.setLoginConfig(new ClassPathResource(resolveConfigFile("/test1.conf")));
  p1.setLoginContextName("test1");
  p1.setCallbackHandlers(new JaasAuthenticationCallbackHandler[] {
      new TestCallbackHandler(), new JaasNameCallbackHandler(),
      new JaasPasswordCallbackHandler() });
  p1.setAuthorityGranters(new AuthorityGranter[] { new TestAuthorityGranter() });
  p1.afterPropertiesSet();
  testAuthenticate(p1);
  p2.setLoginConfig(new ClassPathResource(resolveConfigFile("/test2.conf")));
  p2.setLoginContextName("test2");
  p2.setCallbackHandlers(new JaasAuthenticationCallbackHandler[] {
      new TestCallbackHandler(), new JaasNameCallbackHandler(),
      new JaasPasswordCallbackHandler() });
  p2.setAuthorityGranters(new AuthorityGranter[] { new TestAuthorityGranter() });
  p2.afterPropertiesSet();
  testAuthenticate(p2);
}
origin: org.apereo.cas/cas-server-webapp-config

/**
 * Configure jaas authentication provider.
 *
 * @param auth the auth
 * @param jaas the jaas
 * @throws Exception the exception
 */
protected void configureJaasAuthenticationProvider(final AuthenticationManagerBuilder auth,
                          final MonitorProperties.Endpoints.JaasSecurity jaas) throws Exception {
  val p = new JaasAuthenticationProvider();
  p.setLoginConfig(jaas.getLoginConfig());
  p.setLoginContextName(jaas.getLoginContextName());
  p.setRefreshConfigurationOnStartup(jaas.isRefreshConfigurationOnStartup());
  p.afterPropertiesSet();
  auth.authenticationProvider(p);
}
org.springframework.security.authentication.jaasJaasAuthenticationProviderafterPropertiesSet

Popular methods of JaasAuthenticationProvider

  • getApplicationEventPublisher
  • getLoginContextName
  • configureJaas
    Hook method for configuring Jaas.
  • configureJaasUsingLoop
    Loops through the login.config.url.1,login.config.url.2 properties looking for the login configurati
  • convertLoginConfigToUrl
  • <init>
  • setLoginConfig
    Set the JAAS login configuration file.
  • setLoginContextName
  • authenticate
  • getAuthorityGranters
  • getCallbackHandlers
  • getLoginConfig
  • getCallbackHandlers,
  • getLoginConfig,
  • getLoginExceptionResolver,
  • handleLogout,
  • setApplicationEventPublisher,
  • setAuthorityGranters,
  • setCallbackHandlers,
  • setLoginExceptionResolver,
  • setRefreshConfigurationOnStartup

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now