Skip to content

Commit

Permalink
Fixed minor formatting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ashanthamara committed Mar 28, 2024
1 parent 071f910 commit ac6369a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testInit() throws Exception {
addUserIntoJDBCUserStore(PRIMARY_USERNAME, PRIMARY_PASSWORD, false);
addUserIntoJDBCUserStore(SECONDARY_USERNAME, SECONDARY_PASSWORD, true);

// Creating, registering and starting application on tomcat
// Creating, registering and starting application on tomcat.
createAndRegisterPlaygroundApplication();
startTomcat();
}
Expand All @@ -131,9 +131,9 @@ public void testUserLogin(String username, String password) throws Exception {

CookieStore cookieStore = new BasicCookieStore();
client = HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build();
// Sending authorization request to IS
// Sending authorization request to IS.
sendAuthorizedPost();
// User (resource owner) authentication
// User (resource owner) authentication.
HttpResponse response = sendLoginPostForCustomUsers(client, sessionDataKey, username, password);
Assert.assertNotNull(response, "Login request failed. Login response is null.");
Header locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION);
Expand All @@ -148,7 +148,7 @@ public void testUserLogin(String username, String password) throws Exception {
Assert.assertNotNull(keyValues, "SessionDataKeyConsent key value is null");
String sessionDataKeyConsent = keyValues.get(0).getValue();
EntityUtils.consume(response.getEntity());
// Authorization
// Authorization.
checkAuthorizationCode(sessionDataKeyConsent);
}

Expand Down Expand Up @@ -201,7 +201,7 @@ private void checkAuthorizationCode(String sessionDataKeyConsent) throws Excepti
String locationHeaderValue = locationHeader.getValue();
Assert.assertNotNull(locationHeader, "Approval Location header is null.");
String authorizationCodeString = StringUtils.substringAfterLast(locationHeaderValue, "?code=");
// Assuring that the authorization code is received, which confirms that the login is successful
// Assuring that the authorization code is received, which confirms that the login is successful.
Assert.assertNotNull(authorizationCodeString, "Authorization code not present, hence login unsuccessful.");
EntityUtils.consume(response.getEntity());
}
Expand Down Expand Up @@ -276,13 +276,13 @@ private void stopTomcat() throws LifecycleException {

private void addSecondaryJDBCUserStore() throws Exception {

//creating database
// Creating database.
H2DataBaseManager dbmanager = new H2DataBaseManager("jdbc:h2:" + ServerConfigurationManager.getCarbonHome()
+ "/repository/database/" + USER_STORE_DB_NAME, DB_USER_NAME, DB_USER_PASSWORD);
dbmanager.executeUpdate(new File(ServerConfigurationManager.getCarbonHome() + "/dbscripts/h2.sql"));
dbmanager.disconnect();

// Register a secondary user store
// Register a secondary user store.
UserStoreReq userStore = new UserStoreReq()
.typeId(USER_STORE_TYPE)
.name(DOMAIN_ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public void testSendAuthorizedPost() throws Exception {
urlParameters.add(new BasicNameValuePair("callbackurl", OAuth2Constant.CALLBACK_URL));
urlParameters.add(new BasicNameValuePair("authorizeEndpoint", OAuth2Constant.APPROVAL_URL));
urlParameters.add(new BasicNameValuePair("authorize", OAuth2Constant.AUTHORIZE_PARAM));
// email scope is to retrieve the email address of the user.
// address scope is to retrieve the country number of the user.
// Email scope is to retrieve the email address of the user.
// Address scope is to retrieve the country of the user.
urlParameters.add(new BasicNameValuePair("scope", OAuth2Constant.OAUTH2_SCOPE_OPENID + " "
+ OAuth2Constant.OAUTH2_SCOPE_EMAIL + " " + OAuth2Constant.OAUTH2_SCOPE_ADDRESS));

Expand Down Expand Up @@ -194,8 +194,8 @@ public void testGetAccessToken() throws Exception {
Secret clientSecret = new Secret(consumerSecret);
ClientAuthentication clientAuth = new ClientSecretBasic(clientID, clientSecret);
URI tokenEndpoint = new URI(OAuth2Constant.ACCESS_TOKEN_ENDPOINT);
// email scope is to retrieve the email address of the user.
// address scope is to retrieve the country of the user.
// Email scope is to retrieve the email address of the user.
// Address scope is to retrieve the country of the user.
TokenRequest request = new TokenRequest(tokenEndpoint, clientAuth, authorizationCodeGrant,
new Scope(OAuth2Constant.OAUTH2_SCOPE_OPENID, OAuth2Constant.OAUTH2_SCOPE_EMAIL,
OAuth2Constant.OAUTH2_SCOPE_ADDRESS));
Expand Down

0 comments on commit ac6369a

Please sign in to comment.