org.springframework.security.authentication.jaas.JaasAuthenticationToken Java Examples

The following examples show how to use org.springframework.security.authentication.jaas.JaasAuthenticationToken. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AtlassianCrowdAuthenticationProviderTest.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Test
public void supports() {
	Assert.assertTrue(
			this.provider.supports(UsernamePasswordAuthenticationToken.class));
	Assert.assertTrue(this.provider.supports(JaasAuthenticationToken.class));
	Assert.assertFalse(this.provider.supports(RuntimeException.class));
}
 
Example #2
Source File: ZosmfAuthenticationProviderTest.java    From api-layer with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testSupports() {
    ZosmfAuthenticationProvider mock = new ZosmfAuthenticationProvider(null, null);

    assertTrue(mock.supports(UsernamePasswordAuthenticationToken.class));
    assertFalse(mock.supports(Object.class));
    assertFalse(mock.supports(AbstractAuthenticationToken.class));
    assertFalse(mock.supports(JaasAuthenticationToken.class));
    assertFalse(mock.supports(null));
}
 
Example #3
Source File: JaasAuthenticationProvider.java    From unitime with Apache License 2.0 5 votes vote down vote up
public Authentication authenticate(Authentication auth) throws AuthenticationException {
	JaasAuthenticationToken ret = (JaasAuthenticationToken)super.authenticate(auth);
	for (GrantedAuthority role: ret.getAuthorities()) {
		UniTimeUserContext user = new UniTimeUserContext(role.getAuthority(), ret.getName(), null, null);
		return new JaasAuthenticationToken(user, ret.getCredentials(), new ArrayList<GrantedAuthority>(user.getAuthorities()), ret.getLoginContext());
	}
	return null;
}