Search in sources :

Example 1 with ResourceOwner

use of com.hw.helper.ResourceOwner in project mt-auth by publicdevop2019.

the class BizUserApiSecurityTest method should_not_able_to_create_user_w_client_missing_right_role.

@Test
public void should_not_able_to_create_user_w_client_missing_right_role() throws JsonProcessingException {
    ResourceOwner user = action.randomCreateUserDraft();
    ResponseEntity<DefaultOAuth2AccessToken> registerTokenResponse = action.getJwtClientCredential(CLIENT_ID_RIGHT_ROLE_NOT_SUFFICIENT_RESOURCE_ID, EMPTY_CLIENT_SECRET);
    String value = registerTokenResponse.getBody().getValue();
    ResponseEntity<Void> pendingUser = action.createPendingUser(user, value, new PendingResourceOwner());
    Assert.assertEquals(HttpStatus.FORBIDDEN, pendingUser.getStatusCode());
}
Also used : PendingResourceOwner(com.hw.helper.PendingResourceOwner) PendingResourceOwner(com.hw.helper.PendingResourceOwner) ResourceOwner(com.hw.helper.ResourceOwner) DefaultOAuth2AccessToken(org.springframework.security.oauth2.common.DefaultOAuth2AccessToken) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

PendingResourceOwner (com.hw.helper.PendingResourceOwner)1 ResourceOwner (com.hw.helper.ResourceOwner)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 DefaultOAuth2AccessToken (org.springframework.security.oauth2.common.DefaultOAuth2AccessToken)1