IntegratedSecurityService implements SecurityService { @Override public ThreadState bindSubject(final Subject subject) { if (subject == null) { throw new AuthenticationRequiredException("Failed to find the authenticated user."); } ThreadState threadState = new SubjectThreadState(subject); threadState.bind(); return threadState; } IntegratedSecurityService(SecurityManagerProvider provider, PostProcessor postProcessor); @Override PostProcessor getPostProcessor(); @Override SecurityManager getSecurityManager(); @Override Subject getSubject(); @Override Subject login(final Properties credentials); @Override void logout(); @Override Callable associateWith(final Callable callable); @Override ThreadState bindSubject(final Subject subject); @Override void authorize(Resource resource, Operation operation); @Override void authorize(Resource resource, Operation operation, Target target); @Override void authorize(Resource resource, Operation operation, String target); @Override void authorize(Resource resource, Operation operation, Target target, String key); @Override void authorize(Resource resource, Operation operation, String target, Object key); @Override void authorize(final ResourcePermission context); @Override void authorize(ResourcePermission context, Subject currentUser); @Override void close(); @Override boolean needPostProcess(); @Override Object postProcess(final String regionPath, final Object key, final Object value,
      final boolean valueIsSerialized); @Override Object postProcess(Object principal, final String regionPath, final Object key,
      final Object value, final boolean valueIsSerialized); @Override boolean isIntegratedSecurity(); @Override boolean isClientSecurityRequired(); @Override boolean isPeerSecurityRequired(); static final String CREDENTIALS_SESSION_ATTRIBUTE; }
@Test public void bindSubject_nullSubject_shouldReturn_null() throws Exception { assertThatThrownBy(() -> this.securityService.bindSubject(null)) .isInstanceOf(AuthenticationRequiredException.class) .hasMessageContaining("Failed to find the authenticated user"); }
@Test public void bindSubject_subject_shouldReturn_ThreadState() throws Exception { ThreadState threadState = this.securityService.bindSubject(this.mockSubject); assertThat(threadState).isNotNull().isInstanceOf(SubjectThreadState.class); }