Codota Logo
org.springframework.security.authentication.jaas
Code IndexAdd Codota to your IDE (free)

How to use org.springframework.security.authentication.jaas

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-security

  public void handle(Callback[] callbacks)
      throws IOException, UnsupportedCallbackException {
    for (JaasAuthenticationCallbackHandler handler : AbstractJaasAuthenticationProvider.this.callbackHandlers) {
      for (Callback callback : callbacks) {
        handler.handle(callback, this.authentication);
      }
    }
  }
}
origin: spring-projects/spring-security

public void onApplicationEvent(SessionDestroyedEvent event) {
  handleLogout(event);
}
origin: spring-projects/spring-security

/**
 * Creates a LoginContext using the Configuration that was specified in
 * {@link #setConfiguration(Configuration)}.
 */
@Override
protected LoginContext createLoginContext(CallbackHandler handler)
    throws LoginException {
  return new LoginContext(getLoginContextName(), null, handler, getConfiguration());
}
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: spring-projects/spring-security

/**
 * Validates the required properties are set. In addition, if
 * {@link #setCallbackHandlers(JaasAuthenticationCallbackHandler[])} has not been
 * called with valid handlers, initializes to use {@link JaasNameCallbackHandler} and
 * {@link JaasPasswordCallbackHandler}.
 */
public void afterPropertiesSet() throws Exception {
  Assert.hasLength(this.loginContextName,
      "loginContextName cannot be null or empty");
  Assert.notEmpty(this.authorityGranters,
      "authorityGranters cannot be null or empty");
  if (ObjectUtils.isEmpty(this.callbackHandlers)) {
    setCallbackHandlers(new JaasAuthenticationCallbackHandler[] {
        new JaasNameCallbackHandler(), new JaasPasswordCallbackHandler() });
  }
  Assert.notNull(this.loginExceptionResolver,
      "loginExceptionResolver cannot be null");
}
origin: spring-projects/spring-security

@Override
protected LoginContext createLoginContext(CallbackHandler handler)
    throws LoginException {
  return new LoginContext(getLoginContextName(), handler);
}
origin: spring-projects/spring-security

@Override
public void afterPropertiesSet() throws Exception {
  super.afterPropertiesSet();
  Assert.notNull(this.configuration, "configuration cannot be null.");
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void afterPropertiesSetNullAuthorityGranters() throws Exception {
  provider.setAuthorityGranters(null);
  provider.afterPropertiesSet();
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void afterPropertiesSetNullConfiguration() throws Exception {
  provider.setConfiguration(null);
  provider.afterPropertiesSet();
}
origin: spring-projects/spring-security

/**
 * Hook method for configuring Jaas.
 *
 * @param loginConfig URL to Jaas login configuration
 *
 * @throws IOException if there is a problem reading the config resource.
 */
protected void configureJaas(Resource loginConfig) throws IOException {
  configureJaasUsingLoop();
  if (this.refreshConfigurationOnStartup) {
    // Overcome issue in SEC-760
    Configuration.getConfiguration().refresh();
  }
}
origin: spring-projects/spring-security

@Test
public void authenticateBadPassword() {
  try {
    provider.authenticate(new UsernamePasswordAuthenticationToken("user", "asdf"));
    fail("LoginException should have been thrown for the bad password");
  }
  catch (AuthenticationException success) {
  }
  verifyFailedLogin();
}
origin: spring-projects/spring-security

@Test
public void testConfigureJaas() throws Exception {
  testConfigureJaasCase(new JaasAuthenticationProvider(),
      new JaasAuthenticationProvider());
}
origin: spring-projects/spring-security

@Test
public void publishNullPublisher() {
  provider.setApplicationEventPublisher(null);
  AuthenticationException ae = new BadCredentialsException("Failed to login");
  provider.publishFailureEvent(token, ae);
  provider.publishSuccessEvent(token);
}
origin: spring-projects/spring-security

@Before
public void setUp() throws Exception {
  this.module = new SecurityContextLoginModule();
  this.module.initialize(this.subject, null, null, null);
  SecurityContextHolder.clearContext();
}
origin: org.springframework.security/spring-security-core

/**
 * Creates a LoginContext using the Configuration that was specified in
 * {@link #setConfiguration(Configuration)}.
 */
@Override
protected LoginContext createLoginContext(CallbackHandler handler)
    throws LoginException {
  return new LoginContext(getLoginContextName(), null, handler, getConfiguration());
}
origin: org.springframework.security/spring-security-core

@Override
protected LoginContext createLoginContext(CallbackHandler handler)
    throws LoginException {
  return new LoginContext(getLoginContextName(), handler);
}
origin: org.springframework.security/spring-security-core

  public void handle(Callback[] callbacks)
      throws IOException, UnsupportedCallbackException {
    for (JaasAuthenticationCallbackHandler handler : AbstractJaasAuthenticationProvider.this.callbackHandlers) {
      for (Callback callback : callbacks) {
        handler.handle(callback, this.authentication);
      }
    }
  }
}
origin: org.springframework.security/spring-security-core

public void onApplicationEvent(SessionDestroyedEvent event) {
  handleLogout(event);
}
origin: org.springframework.security/spring-security-core

@Override
public void afterPropertiesSet() throws Exception {
  super.afterPropertiesSet();
  Assert.notNull(this.configuration, "configuration cannot be null.");
}
origin: spring-projects/spring-security

@Test
public void authenticateBadUser() {
  try {
    provider.authenticate(new UsernamePasswordAuthenticationToken("asdf",
        "password"));
    fail("LoginException should have been thrown for the bad user");
  }
  catch (AuthenticationException success) {
  }
  verifyFailedLogin();
}
org.springframework.security.authentication.jaas

Most used classes

  • JaasGrantedAuthority
    GrantedAuthority which, in addition to the assigned role, holds the principal that an AuthorityGran
  • JaasAuthenticationToken
    UsernamePasswordAuthenticationToken extension to carry the Jaas LoginContext that the user was logge
  • DefaultJaasAuthenticationProvider
    Creates a LoginContext using the Configuration provided to it. This allows the configuration to be
  • JaasAuthenticationProvider
    An AuthenticationProvider implementation that retrieves user details from a JAAS login configuration
  • AuthorityGranter
    The AuthorityGranter interface is used to map a given principal to role names. If a Windows NT logi
  • JaasPasswordCallbackHandler,
  • JaasAuthenticationFailedEvent,
  • JaasAuthenticationSuccessEvent,
  • AbstractJaasAuthenticationProvider$InternalCallbackHandler,
  • AbstractJaasAuthenticationProvider,
  • JaasAuthenticationCallbackHandler,
  • LoginExceptionResolver,
  • InMemoryConfiguration,
  • DefaultJaasAuthenticationProviderTests,
  • JaasAuthenticationProviderTests$MockLoginContext,
  • JaasAuthenticationProviderTests,
  • Sec760Tests,
  • SecurityContextLoginModule,
  • TestAuthorityGranter
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