I want to know how to do authenticate for REST web service in java?
My supervisor want to get the format like amazon s3curl.
Everytime user request, they need to give id key and access key.
Which API should i used or for reference or sample code?
Amazon has an AWS SDK for Java that includes a sample S3 project, from which you could learn how they do authentication.
Related
I am trying to implement a spring boot application with DocuSign for getting all Envelopes and generating signing ceremony URL links for individual Envelopes which will be displayed in my app to the signer. I am not able to do it because I am not getting how to do authentication and which type of authentication I need to use. Should I use SDK or without SDK I should do? Any example source code for reference.
From your question, it sounds like the people who will use your app are signers. Therefore they will typically not have a DocuSign account login.
So:
You should use DocuSign's JWT OAuth flow. Use it to obtain an access token for a "system user" in your DocuSign account such as hr_department#yourcompany.com
Use the user version of the JWT flow, not the application version. Here is the implementation of the requestJWTUserToken method.
Best would be to include the SDK in your project and call the requestJWTUserToken method. If you can't do that, then you can copy the source into your app.
The SDK works with Spring-Boot.
Use the resulting access token in your app to call the eSignature REST API
From my application I have to invoke external http service which uses google authentication. It works when I invoke it from browser. I found out that it happens because I have cookie which contains
GCP_IAAP_AUTH_TOKEN_<random_string>
GCP_IAP_UID
So my cookie look like this:
cookie: GCP_IAP_UID=111111111111; GCP_IAAP_AUTH_TOKEN_1234567891234567890B=verylongstringhere"
I tried to set this cookie directly in my restTemplate and it works properly but I expect that I have to get token based on some kind of credentials.
webClient.post()
.uri(uploadUrl)
.header("cookie", "GCP_IAP_UID=12345678901234567890; GCP_IAAP_AUTH_TOKEN_12345678907645456546B=verylongstringhere")
Could you please provide example of correct usage GCP auth ? How to update token? Based on what?
Google APIs use the OAuth 2.0 protocol for authentication and authorization
You can obtain OAuth 2.0 client credentials from the Google API Console. Then your client application requests an access token from the Google Authorization Server, extracts a token from the response, and sends the token to the Google API that you want to access.
Before your application can access private data using a Google API, it must obtain an access token that grants access to that API.
There are several ways to make this request, and they vary based on the type of application you are building. For example, a JavaScript application might request an access token using a browser redirect to Google, while an application installed on a device that has no browser uses web service requests.
I recommend you to go trough OAuth 2.0 to Access Google APIs article to choose the best method for your application, there are a couple of documented scenarios to explain how GCP uses application authentication
I'm deploying my java application in openshift project. I have created service account, but now I dont know how to obtain token for this account inside my java application, that relates to this account.
I'm using openshift java rest client v.6.1.1. My authorization looks like
Client client = new ClientBuilder(KEY_SERVER_URL).build();
client.getAuthorizationContext().setToken(System.getenv(TOKEN));
and it seems unsecure to pass token as environment variable.
Can you help me with obtaining AuthorizationContext using service account, related to this application?
The token for the service account is mounted inside the pod and can be read from /var/run/secrets/kubernetes.io/serviceaccount/token
I have created a simple application in Java which Connects to my Office 365 Account and retrieve the unread messages. I am performing some text matching and pattern matching to generate some reports which I receive via Email.
I am using the below url with basic Authentication to do so.
https://outlook.office365.com/api/v1.0/me/messages?$filter=IsRead%20eq%20false
However, I have read a couple of articles and most of them have suggested that Basic Authentication will not be supported and suggested to use OAUTH2.0.
I am not sure how to use OAUTH2.0. A couple of articles mention about registering the Application with AAD for which i need to have access to Azure Management Portal which i do not have. Please can any one guide me how this can be done.
PS: I am using my Corporate Domain Account to access Office
You are correct that Basic will not continue to be supported. You do not need the Azure management portal to register an application, you can use the App Dev portal (apps.dev.microsoft.com) to get a client ID and secret.
Here's a walkthrough for creating a Java web app from scratch: https://dev.outlook.com/restapi/tutorial/java. It shows how to register the app and do the authentication.
I would like to access users' data of the fitbit by using fitbit API
what I understood is,
1- I have to get users consent by OAuth 2.0 authentication.
2- Get the access token.
3- Then can request the data by using the token.
I have downloaded the OAuth 2.0 Library from this link http://www.java2s.com/Code/Jar/o/Downloadoauth2jar.htm
I have read the fitbit API documentation and I have fill the request by the parameter described in the doc as the following example
https://www.fitbit.com/oauth2/authorize?response_type=token&client_id=22942C&redirect_uri=http%3A%2F%2Fexample.com%2Ffitbit_auth&scope=activity%20nutrition%20heartrate%20location%20nutrition%20profile%20settings%20sleep%20social%20weight&expires_in=604800
The question is how to do this requests in my java app? what is the missing I have to install it to able make a http request from the java.
Also, where and how I can use the OAuth 2.0 lib if the http request will be done by Java
Thank you
Take a look at the Google OAuth Java client. There is a sample of how to use the client available here.