I am attempting to add a JAR to WSO2 IS 5.11.0 so that I can call the getSessionData function from the Script Based Adaptive Authentication console.
I cloned the identity-conditional-auth-functions repository and built the session module found here using maven. I then placed the created JAR in each of the following places and restarted WSO2 IS:
CARBON_HOME/repository/components/dropins
CARBON_HOME/lib
CARBON_HOME/repository/components/lib
CARBON_HOME/repository/components/extensions
From the Script Based Adaptive Authentication console I then call getSessionData which is a function registered inside of the JAR I added. When I login and trigger the script I get the following error:
eval>:9 ReferenceError: "getSessionData" is not defined
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:319)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:291)
at jdk.scripting.nashorn/jdk.nashorn.internal.objects.Global.__noSuchProperty__(Global.java:1616)
...
How can I get WSO2 IS to add custom functions that I am able to call from the Script Based Adaptive Authentication console?
Related
I'm trying to setup multiple environments for my Vue / Firebase Project.
I have two Firebase Projects
1.) Dev
2.) Prod
The project utilizes Stripe Extension which pulls the API Key from an auto-generated file called:
firestore-stripe-payments.env
which contains:
STRIPE_API_KEY=projects/${param:PROJECT_NUMBER}/secrets/firestore-stripe-payments-STRIPE_API_KEY-xxxx/versions/latest
Where xxxx is a random 4 character string.
That line pulls the value of the key from Google Secret Manager.
Let's say Dev is 'dddd'
and Prod is: 'pppp'
The issue is that I can only define either:
firestore-stripe-payments-STRIPE_API_KEY-dddd
or
firestore-stripe-payments-STRIPE_API_KEY-pppp
At first I tried to create a new value within Google Secret Manager simply called:
firestore-stripe-payments-STRIPE_API_KEY
The thought was this should be a simple fix, and it would pull the associated API_KEY for the project currently being used.
but this causes the error:
Error: firestore-stripe-payments: Found 'projects/foo/secrets/firestore-stripe-payments-STRIPE_API_KEY/versions/latest' for secret param STRIPE_API_KEY, but this instance was previously using a different secret projects/fooo/secrets/firestore-stripe-payments-STRIPE_API_KEY-dddd.
Changing secrets is not supported. If you want to change the value of this secret, use a new version of projects/foo/secrets/firestore-stripe-payments-STRIPE_API_KEY-dddd.You can create a new version at https://console.cloud.google.com/security/secret-manager?project=fooo
Also, if there is a better place to ask this question please let me know, couldn't find the 'right' room
For this scenario, could you include a separate env (env.dev) file using the following guidelines
.env # loaded in all cases
.env.local # loaded in all cases, ignored by git
.env.[mode] # only loaded in specified mode
.env.[mode].local
For generating separate keys for each environment, I believe from your example you are using a single Stripe Extension on a single project.
Firebase Extensions can support multiple instances of an Extension per project, this will create a separate "dev" secret for you to use.
Additionally, a separate Firebase project with another "Stripe Extension" installation would be recommended to separate any concerns in development.
I tried to follow the steps given in the below WSO2 documentation link to customize the APIM management console's interface but the changes don't reflect after restarting the carbon server. Need suggestions on this.
Documentation link: https://apim.docs.wso2.com/en/latest/install-and-setup/setup/advance-configurations/customizing-the-management-console/#!
Steps followed as per documentation:
Copied the org.wso2.carbon.ui_4.6.0.jar from <PRODUCT_HOME>/repository/components/plugins/ to a separate location.
Created a MMP with name org.wso2.carbon.ui_4.6.0_patch and added new css file and image file under the MMP. Copied the template.jsp from the org.wso2.carbon.ui_4.6.0.jar and placed it under this MMP project. Within this jsp file, reference of the new css file was added.
Created one more MMP with name org.wso2.carbon.ui_4.6.0_fragment and within its pom.xml added a plugin to point to the org.wso2.carbon.ui_4.6.0_patch MMP.
Created jars for both the MMPs' using maven and copied them under <PRODUCT_HOME>/repository/components/dropins/.
Restarted the WSO2 APIM server but the changes didn't reflect in the management console (https://localhost:9443/carbon) as given in the documentation.
Please follow the instructions given in documentation [1]. The document that you have pointed out has to be updated.
[1] https://is.docs.wso2.com/en/latest/setup/customizing-the-management-console/#customizing-the-management-console
I have created and published API's using API manager 2.6.0 now I need to push these changes to another environment like system & UAT testing environment.
Can someone help me on how I can configure any repository to push the APIs created using API manager and move from one environment to another. I checked few sites related to WSO2 migration and CI/CD implementation but I could not able to do that properly so I am looking for high level explanation to use repository and migration to different environments.
You can export and import APIs from different environments using the migration APIs or the CLI tool:
Export API as seen here: https://docs.wso2.com/display/AM210/Migrating+the+APIs+to+a+Different+Environment
Export CLI as seen here:
https://docs.wso2.com/display/AM260/Migrating+the+APIs+to+a+Different+Environment
The exported APIs are a set of json and xml files that can be templated, and unless your APIs endpoints in other environments are the same as your development one, you will have to modify the exported APIs jsons and xmls to fit the other enviroment's data.
The best way to set up a repository, will be then to:
Export from your development environment the API to a local machine
Create a template out of it to be used with your favorite template deployment engine
Upload this templates to a repository manager (nexus, artifactory...)
Write the script to fill the template for each environment,
Create another script to call the APIM import CLI or API to import the filled template to each enviroment.
This is all best done within some CI/CD pipeline.
I am following the camunda guide on github and successfully able to start my Process_1 by using #PostDeploy method in my ExampleProcessApplication class.
Now I want to use a REST API in the karaf environment so that I can start a process when I get some external triggering.
I installed camunda-bpm-karaf-feature-minimal by following the github helper.
I am not able to call feature:install camunda-bpm-karaf-feature-full (I am using Apache karaf 3.0.7) error msg is as follows:
Missing requirements osgi.wiring.package=javax.transaction
I couldn't find how to install version 1.3.
Do I need to install any other bundle to use a REST API in karaf environment?
I have noticed that they changed their javax.transaction api from com.springsource.javax.transaction to javax.transaction-api when they changed from 1.3 to 2.0. I recommend you to use their 2.0 version feature.
I am new to CQ5. I created a bundle that is configurable via the OSGi console. Now, I need the value that is configured on the console to be returned to my content page. I am not sure how to proceed with this. Looking for any tutorial or help. Thanks in advance.
Assuming the configured value is available via an OSGi service, you can access that service from java code using an #Reference SCR annotation with a suitable build setup to generate the corresponding OSGi metadata. You can also access OSGi services from scripts, in JSP that's done using sling.getService(YourService.class) in a script where you have called or its CQ equivalent.