@Test
    void verifyOperation() {
        val registeredService = addRegisteredService();
        val request = new MockHttpServletRequest();
        val response = new MockHttpServletResponse();
        request.addParameter(OAuth20Constants.CLIENT_ID, registeredService.getClientId());

        val logic = new DefaultSecurityLogic();
        logic.setLoadProfilesFromSession(false);
        
        val mockClient = mock(DirectClient.class);
        when(mockClient.getName()).thenReturn("MockIndirectClient");
        when(mockClient.isInitialized()).thenReturn(true);
        val testCredential = new UsernamePasswordCredentials("casuser", "Mellon");
        when(mockClient.getCredentials(any())).thenReturn(Optional.of(testCredential));
        when(mockClient.validateCredentials(any(), any())).thenReturn(Optional.of(testCredential));
        val profile = new CommonProfile();
        profile.setId(UUID.randomUUID().toString());
        when(mockClient.getUserProfile(any(), any())).thenReturn(Optional.of(profile));

        val context = new JEEContext(request, response);
        val profileManager = new ProfileManager(context, new JEESessionStore());
        profileManager.save(true, profile, false);

        val config = new Config(mockClient);
        config.setSessionStoreFactory(JEESessionStoreFactory.INSTANCE);
        config.setHttpActionAdapter(JEEHttpActionAdapter.INSTANCE);
        config.setWebContextFactory(JEEContextFactory.INSTANCE);
        config.setProfileManagerFactory((webContext, sessionStore) -> profileManager);
        
        val result = (UserProfile) logic.perform(config,
            (webContext, sessionStore, collection) -> collection.iterator().next(),
            "MockIndirectClient",
            DefaultAuthorizers.IS_FULLY_AUTHENTICATED, DefaultMatchers.SECURITYHEADERS,
            new JEEFrameworkParameters(request, response));
        assertNotNull(result);
        assertEquals(1, profileManager.getProfiles().size());
    }
This is {@link OAuth20AccessTokenSecurityLogicTests}.

@author Misagh Moayyed
@since 6.5.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/support/oauth/web/OAuth20AccessTokenSecurityLogicTests.java