day 7: Authentication and Authorization

This commit is contained in:
Sami 2024-10-12 02:36:38 -04:00
parent d941144f8c
commit be05e06a96

View File

@ -51,13 +51,23 @@ public class AuthenticationTest {
.then().statusCode(200).log().all();
}
@Test(priority = 5)
// @Test(priority = 5)
void testOAuth1Auth() {
System.out.println("Starting the authenticantion using OAuth1 auth");
String bearerToken = "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";
given()
.auth().oauth("consumerKey", "consumerSecret", "accessToken", "tokenSecret")
.when()
.get("https://api.github.com/user/repos")
.then().statusCode(200).log().all();
}
given().headers("Authorization", "Bearer " + bearerToken)
.when().get("https://api.github.com/user/repos")
@Test(priority = 6)
void testOAuth2Auth() {
System.out.println("Starting the authenticantion using OAuth2 auth");
given()
.auth().oauth2("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")
.when()
.get("https://api.github.com/user/repos")
.then().statusCode(200).log().all();
}
}