Addd Authorization to http endpoint in elsa workflow - elsa-workflows

I tried with token bearer and still api works without token.Is there any way how we can achieve Authorization in elsa workflow.

Elsa 2.3 and below don't support HTTP Endpoint authorization. For that, you would need to update to Elsa 2.4.x (currently released as preview packages available from MyGet.
You will then see a new option that you can enable:
You can optionally specify a policy name to evaluate. If no policy is specified, the HTTP Endpoint will execute for any & all authenticated requests and reject anonymous requests.

Related

Istio Token Validation via Proxy

Istio supports AuthZ and AuthN services, but is there a way to implement a token validation via a proxy?
Example: User/Client sends a request to Service-A, the request hits to istio-ingressGateway and Gateway validates the token via another service (Validation Service) if the token is valid user/client can get the user data if not send an error equivalent response.
You can write a micro-gateway service using Netflix Zuul which will be the landing service from your Istio Gateway. It can do quick token validation using Zuul filters and then forward the request to the desired service or return a token error response. You can use this service for issuing tokens and also hosting the JWK keys for JWT tokens.
I've written a Java implementation for the same.
Otherwise, you can use an internal Nginx server as a landing for all your request and then use http_auth_request_module to do a quick auth and then proxy forward to other services. You can find it on Nginx documentation.
Unfortunately, I didn't find anything as such provided by Istio as of now.
Posted community wiki answer for better visibility. As Tushar Mistry mentioned in the comments - problem is solved based on this article:
This was the second blog I found while searching oauth2-proxy with istio, he uses Envoy Filter for authorization, but latest istio provides external authorization Today I was successful in redirecting unauthorized request to oauth-proxy2 with istio external authorization, now facing problem after authentication says login failed CSRF token not found
and later:
Implemented this method sucessfully will share a blog if got time.
See also Better External Authorization.

How do we programatically create a Project and Agent in Dialogflow?

I am trying to automate the creation of Dialogflow agent and project from my Spring Boot Microservice application. The same is working very well on API explorer provided by google. But when I try the same from Postman to make a http call (which later I can do the same process inside the application) the authorization fails with insufficient permissions.
The same is possible with OAuth 2.0 integration from JavaScript layer. Here, the one using the UI will be layman and we don't want to expose Dialogflow logic to the end users and hence looking to do the same from microservice.
Is it possible to programatically create agents or that is not a feasible thing to do?
To answer your question, Dialogflow agents can be created programmatically:
Dialogflow v2 API provides methods which can be used to interact with Dialogflow agent programmatically.
First you have to create a Google cloud project which can be done using API method as mentioned in the documentation, make a note of the Project Id which will be used to call the Dialogflow API.
Enable Dialogflow API in your Google Cloud project
According to the documentation, projects.setAgent method is used to create or update the Dialogflow agent.
You can try it on the API explorer by providing the required parameters
agent.parent: projects/<project_id>
request body:
{
"displayName": "<Agent_name>"
}
Enable the credentials and execute it. You will get a 200 success response and a new Agent will be created in the Dialogflow Console.
If you want to access Dialogflow from Postman:
Create an OAuth 2.0 client ID
From Postman, create a new Request and select the “Authorization” tab and choose Type "OAuth 2.0". Click 'Get New Access Token'
send get/post request to the Dialogflow API
For a detailed demo refer to this Github Link.
You have to include these things in the request header
- grant_type = refresh_token
- approval_prompt = force
- redirect_uri
- client_id
- client_secret
- prompt = consent
- access_type = offline
- refresh_token
By including these authorization will be successfull.

token introspection endpoint in ADFS 4.0

Is there any token introspection endpoint available in ADFS?
I am using the oauth2 configuration to get the token. I can verify the token in the resource server by jwks keys. I am able to check the validity of the token. but not the actual status. I was trying using the tutorial for checking the status. but I can't find the introspection endpoint.
This OAuth standard specifies that there will be one introspection endpoint.
I am not sure that https://adfs_domain/adfs/oauth2/token/introspect this URL is correct. but when I tried I got
Error details: MSIS7065: There are no registered protocol handlers on
path /adfs/oauth2/token/introspect to process the incoming request.
can anyone help?
No - this endpoint is not implemented.
You can see the list of available endpoints in the ADFS wizard / Services / Endpoints.

How to generate session id and auth bearer token for a payment sandbox http request and it is not available in any of the previous request

There is a ecommerce application in which I have to add product and make payment for checkout. Payment mode is sandbox for now.
So, Payment.sandbox.api http request url is having session id in the payload and auth bearer token in http request header, but these are not available in any of the previous response ,so that I can fetch it from the response but that is not available
So further it is giving me authentication issue,that credentials are invalid, that may be because of session id and auth token. So how to handle them or how to populate them automatically as I am not getting in any of the previous request?
Looking into BrainTree Documentation there are 2 ways of authenticating the client:
Tokenization Keys - can be obtained from production or sandbox control panel
Client Token - you need to replicate client authentication flow, JMeter is Java-based application so I believe the easiest would be using Braintree Java SDK from the JSR223 Preprocessor

Laravel: API with OAuth 2.0

I am currently developing an API that I plan to secure using oauth2.
I have chosen: https://github.com/lucadegasperi/oauth2-server-laravel/
I have managed to secure the endpoint (using before=>oauth in my api routes) by following the installation guide but I am at a loss as to how am I gonna be able to authenticate and access the endpoint.
I do understand that you will first need to request an access_token by sending a client_id and client_secret but what I don't get is where do I set those on the oauth server?
I see the oauth controller has endpoints for these like:
http://somedomain.com/oauth/authorize
http://somedomain.com/oauth/access_token
But I am clueless with what to do with them. I only managed to arrive at the conclusion that it needs a client_id, client_secret, and stuff about scopes.
Where can I set these values for the api client to use?
Thank you for your help in advance.
I don't know Laravel, but in general, the authorization endpoint (in your case, http://somedomain.com/oauth/authorize) behaves as described in RFC 6749.
The specification defines four flows. If you use Authorization Code Flow among the flows, you should access the authorization endpoint with the following request parameters.
response_type=code (required)
client_id={your-client-id} (required)
scope={space-delimited-scope-names} (optional)
redirect_uri={your-redirect-uri} (conditionally optional)
state={any-arbitrary-string} (optional)
For example,
http://somedomain.com/oauth/authorize?response_type=code&client_id=your-client-id&scope=profile+email
The authorization endpoint generates an authorization code and returns it to your browser.
The next step is to access the token endpoint (in your case, http://somedomain.com/oauth/access_token) with the authorization code which has been issued from the authorization endpoint. Like this,
POST
http://somedomain.com/oauth/access_token?grant_type=authorization_code&code=issued-authorization-code&client_id=your-client-id&client_secret=your-client-secret
Anyway, I recommend you read RFC 6749.

Resources