-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19434 from shanggeeth/graaljs
Add integration tests for GraalJS based adaptive authentication script execution
- Loading branch information
Showing
6 changed files
with
197 additions
and
5 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...ava/org/wso2/identity/integration/test/auth/NashornAdaptiveScriptInitializerTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.wso2.identity.integration.test.auth; | ||
|
||
import org.testng.annotations.AfterTest; | ||
import org.testng.annotations.BeforeTest; | ||
import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager; | ||
import org.wso2.carbon.utils.CarbonUtils; | ||
import org.wso2.identity.integration.common.utils.ISIntegrationTest; | ||
|
||
import java.io.File; | ||
|
||
public class NashornAdaptiveScriptInitializerTestCase extends ISIntegrationTest { | ||
|
||
private ServerConfigurationManager scm; | ||
private File defaultConfigFile; | ||
|
||
@BeforeTest(alwaysRun = true) | ||
public void initScriptEngineConfig() throws Exception { | ||
|
||
super.init(); | ||
String carbonHome = CarbonUtils.getCarbonHome(); | ||
defaultConfigFile = getDeploymentTomlFile(carbonHome); | ||
File scriptEngineConfigFile = new File( | ||
getISResourceLocation() + File.separator + "scriptEngine" + File.separator + | ||
"nashorn_script_engine_config.toml"); | ||
scm = new ServerConfigurationManager(isServer); | ||
scm.applyConfiguration(scriptEngineConfigFile, defaultConfigFile, true, true); | ||
} | ||
|
||
@AfterTest(alwaysRun = true) | ||
public void resetScriptEngineConfig() throws Exception { | ||
|
||
super.init(); | ||
scm.restoreToLastConfiguration(false); | ||
scm.restartGracefully(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...egration/tests-backend/src/test/resources/artifacts/IS/identity_new_resource_nashorn.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[server] | ||
hostname = "localhost" | ||
node_ip = "127.0.0.1" | ||
base_path = "https://$ref{server.hostname}:${carbon.management.port}" | ||
|
||
[super_admin] | ||
username = "admin" | ||
password = "admin" | ||
create_admin_account = true | ||
|
||
[user_store] | ||
type = "database_unique_id" | ||
|
||
[database.identity_db] | ||
driver = "$env{IDENTITY_DATABASE_DRIVER}" | ||
url = "$env{IDENTITY_DATABASE_URL}" | ||
username = "$env{IDENTITY_DATABASE_USERNAME}" | ||
password = "$env{IDENTITY_DATABASE_PASSWORD}" | ||
|
||
[database.shared_db] | ||
driver = "$env{SHARED_DATABASE_DRIVER}" | ||
url = "$env{SHARED_DATABASE_URL}" | ||
username = "$env{SHARED_DATABASE_USERNAME}" | ||
password = "$env{SHARED_DATABASE_PASSWORD}" | ||
|
||
[keystore.primary] | ||
file_name = "wso2carbon.jks" | ||
password = "wso2carbon" | ||
|
||
[[resource.access_control]] | ||
context = "(.*)/sample-auth/(.*)" | ||
secure = false | ||
http_method = "all" | ||
|
||
[AdaptiveAuth] | ||
ScriptEngine = "nashorn" |
77 changes: 77 additions & 0 deletions
77
...ts-backend/src/test/resources/artifacts/IS/scriptEngine/nashorn_script_engine_config.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
[server] | ||
hostname = "localhost" | ||
node_ip = "127.0.0.1" | ||
base_path = "https://$ref{server.hostname}:${carbon.management.port}" | ||
|
||
[super_admin] | ||
username = "admin" | ||
password = "admin" | ||
create_admin_account = true | ||
|
||
[user_store] | ||
type = "database_unique_id" | ||
|
||
[database.identity_db] | ||
type = "h2" | ||
url = "jdbc:h2:./repository/database/WSO2IDENTITY_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000" | ||
username = "wso2carbon" | ||
password = "wso2carbon" | ||
|
||
[database.shared_db] | ||
type = "h2" | ||
url = "jdbc:h2:./repository/database/WSO2SHARED_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000" | ||
username = "wso2carbon" | ||
password = "wso2carbon" | ||
|
||
[keystore.primary] | ||
file_name = "wso2carbon.jks" | ||
password = "wso2carbon" | ||
|
||
[truststore] | ||
file_name="client-truststore.jks" | ||
password="wso2carbon" | ||
type="JKS" | ||
|
||
[account_recovery.endpoint.auth] | ||
hash= "66cd9688a2ae068244ea01e70f0e230f5623b7fa4cdecb65070a09ec06452262" | ||
|
||
[identity.auth_framework.endpoint] | ||
app_password= "dashboard" | ||
|
||
# The KeyStore which is used for encrypting/decrypting internal data. By default the primary keystore is used as the internal keystore. | ||
|
||
#[keystore.internal] | ||
#file_name = "$ref{keystore.primary.file_name}" | ||
#type = "$ref{keystore.primary.type}" | ||
#password = "$ref{keystore.primary.password}" | ||
#alias = "$ref{keystore.primary.alias}" | ||
#key_password = "$ref{keystore.primary.key_password}" | ||
|
||
# The KeyStore which is used for tls communication. By default the primary keystore is used as the tls keystore. | ||
|
||
#[keystore.tls] | ||
#file_name = "$ref{keystore.primary.file_name}" | ||
#type = "$ref{keystore.primary.type}" | ||
#password = "$ref{keystore.primary.password}" | ||
#alias = "$ref{keystore.primary.alias}" | ||
#key_password = "$ref{keystore.primary.key_password}" | ||
|
||
#Google reCAPTCHA settings. | ||
|
||
#[recaptcha] | ||
#enabled = true | ||
#api_url = "https://www.google.com/recaptcha/api.js" | ||
#verify_url = "https://www.google.com/recaptcha/api/siteverify" | ||
#site_key = "" | ||
#secret_key = "" | ||
|
||
# SMTP email sender settings. | ||
#[output_adapter.email] | ||
#from_address= "abcd@gmail.com" | ||
#username= "abcd" | ||
#password= "xxxx" | ||
#hostname= "smtp.gmail.com" | ||
#port= 587 | ||
|
||
[AdaptiveAuth] | ||
ScriptEngine = "nashorn" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters