tokenRequest.setRedirectUri(redirectUri); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST); tokenRequest.addCustomParameter("myCustomAttr1", customAttrValue1);
tokenRequest.setKeyId(keyId); tokenRequest.setAudience(audience); tokenRequest.addCustomParameter("uid", userId); tokenRequest.addCustomParameter("pwd", userSecret);
tokenRequest.setAuthPassword(clientSecret1); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST); tokenRequest.addCustomParameter("mail", userEmail); tokenRequest.addCustomParameter("inum", userInum);
tokenRequest.setAuthPassword(clientSecret2); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST); tokenRequest.addCustomParameter("uid", userId); tokenRequest.addCustomParameter("pwd", userSecret);
tokenRequest.setScope("profile email"); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST); tokenRequest.addCustomParameter("myCustomAttr1", customAttrValue1);
tokenRequest.setAuthPassword(clientSecret3); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_BASIC); tokenRequest.addCustomParameter("mail", userEmail); tokenRequest.addCustomParameter("inum", userInum);
@Parameters({"userId", "userSecret"}) @Test(dependsOnMethods = "requestClientRegistrationWithCustomAttributes") public void requestAccessTokenCustomClientAuth2(final String userId, final String userSecret) throws Exception { showTitle("requestAccessTokenCustomClientAuth2"); String username = userId; String password = userSecret; TokenRequest tokenRequest = new TokenRequest(GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS); tokenRequest.setUsername(username); tokenRequest.setPassword(password); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST); tokenRequest.addCustomParameter("myCustomAttr1", customAttrValue1); TokenClient tokenClient = new TokenClient(tokenEndpoint); tokenClient.setRequest(tokenRequest); TokenResponse tokenResponse = tokenClient.exec(); showClient(tokenClient); assertEquals(tokenResponse.getStatus(), 200, "Unexpected response code: " + tokenResponse.getStatus()); assertNotNull(tokenResponse.getEntity(), "The entity is null"); assertNotNull(tokenResponse.getAccessToken(), "The access token is null"); assertNotNull(tokenResponse.getTokenType(), "The token type is null"); assertNotNull(tokenResponse.getRefreshToken(), "The refresh token is null"); } }
tokenRequest.setAuthUsername(clientId); tokenRequest.setAuthPassword(clientSecret); tokenRequest.addCustomParameter("mail", userEmail); tokenRequest.addCustomParameter("inum", userInum); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST);
tokenRequest.setAuthUsername(clientId); tokenRequest.setAuthPassword(clientSecret); tokenRequest.addCustomParameter("mail", userEmail); tokenRequest.addCustomParameter("inum", userInum); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_BASIC);
tokenRequest.setAuthUsername(clientId); tokenRequest.setAuthPassword(clientSecret); tokenRequest.addCustomParameter("uid", userId); tokenRequest.addCustomParameter("pwd", userSecret); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST);
tokenRequest.setAuthUsername(clientId); tokenRequest.setAuthPassword(clientSecret); tokenRequest.addCustomParameter("uid", userId); tokenRequest.addCustomParameter("pwd", userSecret); tokenRequest.setAudience(tokenEndpoint); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_JWT);
tokenRequest.setRedirectUri(redirectUri); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST); tokenRequest.addCustomParameter("myCustomAttr1", customAttrValue1);