Skip to content

Commit

Permalink
fix: remove RCUserId as required request header value for getWebToken
Browse files Browse the repository at this point in the history
* is not needed for generating the token
  • Loading branch information
hill-daniel committed Apr 7, 2022
1 parent 9f3ca31 commit 9fa899e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
5 changes: 0 additions & 5 deletions api/videoservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ paths:
[Authorization: Role: consultant, anonymous]'
operationId: getWebToken
parameters:
- name: RCUserId
in: header
required: true
schema:
type: string
- name: roomId
in: path
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ResponseEntity<Void> rejectVideoCall(@Valid RejectVideoCallDTO rejectVide
}

@Override
public ResponseEntity<VideoCallInfoDTO> getWebToken(String rcUserId, String roomId) {
public ResponseEntity<VideoCallInfoDTO> getWebToken(String roomId) {
var videoCallInfo = videoCallUrlGeneratorService.generateJwt(roomId);

return ResponseEntity.ok(videoCallInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ public void rejectVideoCall_Should_ReturnOkAndCallService_WhenUserRole()
@WithAnonymousUser
public void getWebToken_should_generate_token_for_anonymous_user() throws Exception {
mvc.perform(get(PATH_GET_WEB_TOKEN)
.header(RC_USER_ID_HEADER, RC_USER_ID_VALUE)
.cookie(csrfCookie)
.header(CSRF_HEADER, CSRF_VALUE)
.contentType(MediaType.APPLICATION_JSON)
Expand All @@ -210,23 +209,10 @@ public void getWebToken_should_return_forbidden_for_request_without_csrf() throw
.andExpect(status().isForbidden());
}

@Test
@WithAnonymousUser
public void getWebToken_should_return_bad_request_for_request_without_rocket_chat_user_id()
throws Exception {
mvc.perform(get(PATH_GET_WEB_TOKEN)
.cookie(csrfCookie)
.header(CSRF_HEADER, CSRF_VALUE)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest());
}

@Test
@WithMockUser(authorities = {AUTHORITY_USER})
public void getWebToken_should_generate_token_for_user() throws Exception {
mvc.perform(get(PATH_GET_WEB_TOKEN)
.header(RC_USER_ID_HEADER, RC_USER_ID_VALUE)
.cookie(csrfCookie)
.header(CSRF_HEADER, CSRF_VALUE)
.contentType(MediaType.APPLICATION_JSON)
Expand All @@ -240,7 +226,6 @@ public void getWebToken_should_generate_token_for_user() throws Exception {
@WithMockUser(authorities = {AUTHORITY_CONSULTANT})
public void getWebToken_should_generate_token_for_consultant() throws Exception {
mvc.perform(get(PATH_GET_WEB_TOKEN)
.header(RC_USER_ID_HEADER, RC_USER_ID_VALUE)
.cookie(csrfCookie)
.header(CSRF_HEADER, CSRF_VALUE)
.contentType(MediaType.APPLICATION_JSON)
Expand Down

0 comments on commit 9fa899e

Please sign in to comment.