-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathAuthUtils.java
More file actions
36 lines (31 loc) · 936 Bytes
/
AuthUtils.java
File metadata and controls
36 lines (31 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.amadeus.client;
import com.amadeus.Configuration;
import com.amadeus.Constants;
import com.amadeus.HTTPClient;
import com.amadeus.HttpVerbs;
import com.amadeus.Params;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
/**
* Utility class for authentication-related operations.
*/
public class AuthUtils {
private AuthUtils() {
// Prevent instantiation
}
public static Params createAuthRequestParams(Configuration config) {
return Params.with(Constants.GRANT_TYPE, Constants.CLIENT_CREDENTIALS)
.and(Constants.CLIENT_ID, config.getClientId())
.and(Constants.CLIENT_SECRET, config.getClientSecret());
}
public static Response executeUnauthenticatedRequest(HTTPClient client, Params params)
throws ResponseException {
return client.unauthenticatedRequest(
HttpVerbs.POST,
Constants.AUTH_URL,
params,
null,
null
);
}
}