Examples of andRespond()


Examples of org.springframework.test.web.client.ResponseActions.andRespond()

        .andExpect(method(POST))
        .andExpect(content().string(expectedClientParams + "code=code&redirect_uri=http%3A%2F%2Fwww.someclient.com%2Fcallback&grant_type=authorization_code"));
    if (expectedAuthorizationHeader != null) {
      responseActions.andExpect(header("Authorization", expectedAuthorizationHeader));
    }
    responseActions.andRespond(withSuccess(new ClassPathResource(responseFile, getClass()), MediaType.APPLICATION_JSON));
    return oauthTemplate.exchangeForAccess("code", "http://www.someclient.com/callback", null);
  }
 
  private AccessGrant passwordGrant_paramBasedClientAuth(String responseFile) {
    return passwordGrant(oAuth2TemplateParamBased, "client_id=client_id&client_secret=client_secret&", null, responseFile);
View Full Code Here

Examples of org.springframework.test.web.client.ResponseActions.andRespond()

        .andExpect(method(POST))
        .andExpect(content().string(expectedClientParams + "username=habuma&password=letmein01&grant_type=password&scope=read%2Cwrite"));
    if (expectedAuthorizationHeader != null) {
      responseActions.andExpect(header("Authorization", expectedAuthorizationHeader));
    }
    responseActions.andRespond(withSuccess(new ClassPathResource(responseFile, getClass()), MediaType.APPLICATION_JSON));
    OAuth2Parameters parameters = new OAuth2Parameters();
    parameters.setScope("read,write");
    return oauthTemplate.exchangeCredentialsForAccess("habuma", "letmein01", parameters);
  }
View Full Code Here

Examples of org.springframework.test.web.client.ResponseActions.andRespond()

        .andExpect(method(POST))
        .andExpect(content().string(expectedClientParams + "grant_type=client_credentials&scope=read%2Cwrite"));
    if (expectedAuthorizationHeader != null) {
      responseActions.andExpect(header("Authorization", expectedAuthorizationHeader));
    }
    responseActions.andRespond(withSuccess(new ClassPathResource(responseFile, getClass()), MediaType.APPLICATION_JSON));
    OAuth2Parameters parameters = new OAuth2Parameters();
    parameters.setScope("read,write");
    return oauthTemplate.authenticateClient("read,write");
  }
View Full Code Here

Examples of org.springframework.test.web.client.ResponseActions.andRespond()

        .andExpect(method(POST))
        .andExpect(content().string(expectedClientParams + "refresh_token=r3fr35h_t0k3n&grant_type=refresh_token"));
    if (expectedAuthorizationHeader != null) {
      responseActions.andExpect(header("Authorization", expectedAuthorizationHeader));
    }
    responseActions.andRespond(withSuccess(new ClassPathResource(responseFile, getClass()), MediaType.APPLICATION_JSON));
    return oauthTemplate.refreshAccess("r3fr35h_t0k3n", null);
  }

}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.