Allow camunda task completion by only candidate users/groups - camunda

I have a Spring boot software that integrates with the Camunda. I am trying to manage the Camunda tasks/execution from the spring boot app, but I am unable to block any user from completing a task via the taskService.
In other words, let's take an example of "Leave request" process.
1- the employee starts a process
2- manager validates the requests >> candidate user = manager
3- send notification to employee
In order to handle the process execution from Spring boot, I us the camunda task service:
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
TaskService taskService = processEngine.getTaskService();
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
taskService.complete(task.getId(), taskVariables);
The thing is that any user can call the taskService.complete(task.getId(), taskVariables) and he will be able to complete the task.
How can I ensure that camunda does not let the user "Employee1" validate the request?

The Spring Boot starter does not enable authorization by default. You can enable authorizations using:
camunda:
bpm:
authorization:
enabled: true
Please see: https://docs.camunda.org/manual/7.17/user-guide/process-engine/authorization-service/
to understand authorization concept and how to configure authorizations for different resources.

Related

WSO2 Identity Server using photo-editor UMA webapp

I am using WSO2 5.9.0
I deployed the photo-edit and photo-view samples as described here and Service providers created successfully. I also setup the three users following the notes.
I start Tomcat Server and I reach photo-edit app. I login with Lily's credentials (admin user) and the next step is to approve username sharing.
I choose approve once and continue and here is my issue. Nothing happen until session expires. I tried to check tomcat logs but i can't find any helpful information.
I had deployed the Playground2 in the past and authentication point works fine. I also try to change callback URL throw WSO2 dashboard (photo-edit service provider) but i get the same callback URL error.
Any thoughts?

How can I remove session for specific user for specific ServiceProvider in WSO2 IS?

There is any webservice providing by WSO2 Identity server, to remove a session for specific user to specific ServiceProvider?
I am using SAMLSSO for many web application and they all are integrating with WSO2 server.
Now let's say scenario is,User is login with 2 application at the same time. I want to logout it from one application.
There is one service provided by logout and it's providing single logout and session will be remove for all application. There is webservice provided by IS or way to achieve logout for one specific application ?
What you are asking is to have the capability of removing a specific participant from the session created in the Identity Server side. I don't see a straight forward way (OOTB) of achieving this.
Closest you can achieve is as below.
Make your application perform a forceAuth. ForceAuth will request for user credentials despite having the cookies in the browser. (This will prevent the user from experiencing the SSO comfort. Still you can authenticate against the IS)
Prevent the application from sending an SLO request to WSO2. Rather, terminate the self(application) session upon logout.
When your application really wants to perform an SLO (logout all the applications, not just yours), your application can send an SLO request to the Identity Server.
Performing a force authentication :
SAML - Send forceAuth=true as a query paramter in your login request. Or else change the SAML AuthenricationRequest payload body to indicate a force authentication as in the spec(Line 2042).
OIDC - Send prompt=login as an additional query parameter in the /authorization request.
You can do this by calling the REST API and SOAP API provided by WSO2 IS. This will remove the session at WSO2 IS but I'm not sure if it will also trigger the SLO to other service providers or not.
Reference:
https://is.docs.wso2.com/en/latest/develop/calling-admin-services/
https://is.docs.wso2.com/en/latest/develop/session-mgt-rest-api/
Trigger a SOAP request getUserProfile from the UserProfileMgtService.wsdl. The default user profile will be 'default' or you can put the customized profile name you used. This will return the details. Grab the user id from this.
Trigger a GET to the API: /{user-id}/sessions with the user-id from step 1 to get the list of all active sessions this user currently have. Go through the list of sessions and find the session ID of the Service Provider you need to clear.
Trigger a DELETE request to API: /{user-id}/sessions/{session-id} with the user id from step 1 & session id from step 2

Where to Find Web Service of Delpoyed BPM in BPS Server in wso2?

I'm new to WSO2 products, I know while integrating BPS with ESB, we require the service of deployed Process
so My Question is:- Where to Find Web Service of Deployed BPM.
Deploying a BPM does not result in a Webservice, one or more processes will be deployed instead. You can find these under processes in the BPMN explorer https://[wso2server]:[port]/bpmn-explorer or they can be accessed through the BPMN rest API REST API Documentation.
If you want webservices that implement processes you should probably go with (WS-)BPEL. BPEL Reference
If you want to start/control the process from your webpage you can use the rest API. To start a process using the API you would send a POST request to the following URL:
https://<Host Name>:<Port>/bpmn/runtime/process-instances
This will create a new instance of the process you have specified in the Request body. All you need to put in the body to create the instance is either the processDefinitionId or processDefinitionKey (you can find both in the BPMN-explorer mentioned above). There are other, optional variables as well as the option to create your instance based on a message but this last option is not recommended.
{
   "processDefinitionKey":"sampleJavaServiceTask"
}
For more info on this, check out the link to the BPMN REST API

Bosun notification URL in subscription

I have fiware-bosun running. I’m trying to create a new rule to send me an email when memory usage is higher than 95% but when I try to subscribe the server to this rule I do not know which notification URL should I have to write in the subscription.
Can you help me?
FIWARE Bosun is a generic enabler instance which acts as a REST notification service, so it is expected to have another REST service that implements the actions.
In your case, you need a REST service expecting a POST request.
The request will be similar to this one:
{"action": "notifyEmail",
"serverId": "00000000000001",
"email": "youremail#host.com",
"description": "Memory usage is higher than 95%"}
ServerId is the OpenStack Id of the server from which you want to check the corresponding rules. Notification URL must be the url of this REST service which is waiting the message to process and send the corresponding email. This service must be implemented by the user.

WSO2: StatisticsClient

How can i use StatisticsAdmin of Application Server
My scenario is : i want to get responsetime of a service that deploy on a server(AppServer/DataServer..) and probed by ESB using discoveryproxy of governance regidtry. if is it possible how can i implement it? otherwise i should be get service response time from AppServer in direct using service name. i can create a proxy of ServerAdminMBean using this package and interface
import org.wso2.carbon.server.admin.service.ServerAdminMBean
but i need to use attributes and method of StatisticsAdmin type. how can i implement it?
you dont need to do your own implementation. it is already in the service statistics page.
You can find the service stat details in the monitor-->System Statistics page. If you need more fine grained details about your service,you might need to integrate BAM with AS.
Once you deploy any service, there's a log message prints in server back end console.(you may noticed that before). That message handled by the "LoggingAdmin" admin service. In that admin service there's a operation called "getSystemLog" and this operation sends all log messages one by one. you can create simple java class to call that admin service and get the deployed time stamp of each of the service you are deployed. if you know the service deployment start time, with above admin service you can get time taken to each of the service deployment.
You can use JMX to access those information. There is StatisticAdmin MBena available for monitoring in . You can refer this to get an idea how to invoke them using Java.