Skip to content

Commit

Permalink
Default playground device code enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Aug 19, 2024
1 parent 5532a06 commit 16c2985
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/oidc/exceptions/InvalidGrantException.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

@ResponseStatus(value = HttpStatus.UNAUTHORIZED)
public class InvalidGrantException extends BaseException {

public InvalidGrantException(String message) {
super(message);
}
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/oidc/endpoints/DeviceAuthorizationEndpointTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@ public void deviceAuthorizationInvalidClient() {
assertEquals(body.get("error"), "unauthorized");
}

@Test
public void deviceAuthorizationInvalidGrant() {
Map<String, Object> body = given()
.when()
.header("Content-type", "application/x-www-form-urlencoded")
.formParam("grant_type", GrantType.AUTHORIZATION_CODE.getValue())
.formParam("client_id", "mock-rp")
.post("oidc/device_authorization")
.as(mapTypeRef);
assertEquals((int) body.get("status"), 401);
assertEquals(body.get("error"), "unauthorized_client");
assertEquals(body.get("error_description"), "Missing grant: urn:ietf:params:oauth:grant-type:device_code for clientId: mock-rp");
}

@SneakyThrows
@Test
public void deviceAuthorizationHappyFlow() {
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/manage/oidc10_rp.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@
"authorization_code",
"implicit",
"refresh_token",
"client_credentials"
"client_credentials",
"urn:ietf:params:oauth:grant-type:device_code"
],
"redirectUrls": [
"http://localhost:3006/redirect",
Expand Down

0 comments on commit 16c2985

Please sign in to comment.