use of io.undertow.security.impl.SingleSignOn in project wildfly by wildfly.
the class DistributableSingleSignOnManagerTestCase method findSingleSignOnNotExists.
@Test
public void findSingleSignOnNotExists() {
String id = "sso";
Batcher<Batch> batcher = mock(Batcher.class);
Batch batch = mock(Batch.class);
when(this.manager.getBatcher()).thenReturn(batcher);
when(batcher.createBatch()).thenReturn(batch);
when(this.manager.findSSO(id)).thenReturn(null);
SingleSignOn result = this.subject.findSingleSignOn(id);
assertNull(result);
verify(batch).close();
verify(batcher, never()).suspendBatch();
}
use of io.undertow.security.impl.SingleSignOn in project wildfly by wildfly.
the class DistributableSingleSignOnManagerTestCase method findSingleSignOnInvalidCharacters.
@Test
public void findSingleSignOnInvalidCharacters() {
String id = "sso+";
SingleSignOn result = this.subject.findSingleSignOn(id);
assertNull(result);
verifyZeroInteractions(this.manager);
}
use of io.undertow.security.impl.SingleSignOn in project wildfly by wildfly.
the class DistributableSingleSignOnManagerTestCase method createSingleSignOn.
@Test
public void createSingleSignOn() {
String id = "sso";
Batcher<Batch> batcher = mock(Batcher.class);
Batch batch = mock(Batch.class);
Account account = mock(Account.class);
String mechanism = HttpServletRequest.BASIC_AUTH;
SSO<AuthenticatedSession, String, String, Void> sso = mock(SSO.class);
ArgumentCaptor<AuthenticatedSession> authenticationCaptor = ArgumentCaptor.forClass(AuthenticatedSession.class);
when(this.manager.createIdentifier()).thenReturn(id);
when(this.manager.getBatcher()).thenReturn(batcher);
when(batcher.createBatch()).thenReturn(batch);
when(this.manager.createSSO(same(id), authenticationCaptor.capture())).thenReturn(sso);
SingleSignOn result = this.subject.createSingleSignOn(account, mechanism);
verify(batcher).suspendBatch();
assertNotNull(result);
AuthenticatedSession capturedAuthentication = authenticationCaptor.getValue();
assertNotNull(capturedAuthentication);
assertSame(capturedAuthentication.getAccount(), account);
assertSame(capturedAuthentication.getMechanism(), mechanism);
}
use of io.undertow.security.impl.SingleSignOn in project wildfly by wildfly.
the class DistributableSingleSignOnManagerTestCase method findSingleSignOn.
@Test
public void findSingleSignOn() {
String id = "sso";
Batcher<Batch> batcher = mock(Batcher.class);
Batch batch = mock(Batch.class);
SSO<AuthenticatedSession, String, String, Void> sso = mock(SSO.class);
when(this.manager.getBatcher()).thenReturn(batcher);
when(batcher.createBatch()).thenReturn(batch);
when(this.manager.findSSO(id)).thenReturn(sso);
SingleSignOn result = this.subject.findSingleSignOn(id);
assertNotNull(result);
verify(batcher).suspendBatch();
}
Aggregations