1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright © 2021 Orange.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 *******************************************************************************/
25 package org.onap.dmaap.mr.client;
27 import com.att.nsa.apiClient.credentials.ApiCredential;
28 import com.att.nsa.apiClient.http.HttpException;
29 import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
31 import java.io.IOException;
34 * A client for manipulating API keys.
38 public interface MRIdentityManager extends MRClient {
44 * Get the email address associated with the API key.
46 * @return the email address on the API key or null
51 * Get the description associated with the API key.
53 * @return the description on the API key or null
55 String getDescription();
59 * Create a new API key on the UEB cluster. The returned credential instance
60 * contains the new API key and API secret. This is the only time the secret
61 * is available to the client -- there's no API for retrieving it later -- so
62 * your application must store it securely.
66 * @return a new credential
67 * @throws HttpException
68 * @throws MRApiException
71 ApiCredential createApiKey(String email, String description) throws HttpException, MRApiException, IOException;
74 * Get basic info about a known API key.
77 * @return the API key's info or null if it doesn't exist
78 * @throws HttpObjectNotFoundException, HttpException, MRApiException
81 ApiKey getApiKey(String apiKey) throws HttpObjectNotFoundException, HttpException, MRApiException, IOException;
84 * Update the record for the API key used to authenticate this request. The UEB
85 * API requires that you authenticate with the same key you're updating, so the
86 * API key being changed is the one used for setApiCredentials.
88 * @param email use null to keep the current value
89 * @param description use null to keep the current value
91 * @throws HttpException
92 * @throws HttpObjectNotFoundException
94 void updateCurrentApiKey(String email, String description) throws HttpObjectNotFoundException, HttpException, IOException;
97 * Delete the *current* API key. After this call returns, the API key
98 * used to authenticate will no longer be valid.
100 * @throws IOException
101 * @throws HttpException
103 void deleteCurrentApiKey() throws HttpException, IOException;