Skip to content
Draft
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a8e457d
Add devportal REST API changes for API keys
Jan 22, 2026
7bf53f6
Add admin rest API changes for API key retrieval and revocation
Jan 23, 2026
d5738c6
Persist api keys in generation
Jan 23, 2026
b455043
Add api key retrieval implementation
Jan 26, 2026
9460ebd
Add api key retrieval logic
Jan 27, 2026
3c90db4
Modify hashing api key implementation
Jan 28, 2026
2309cab
Add opaque api key generation logic and enabled JWT api key generatio…
Jan 28, 2026
fca4c33
Add opaque API key revocation implementation
Jan 30, 2026
8294fa3
Add API key regerenation implementation
Feb 2, 2026
d81b735
Add changes to save API key last used time
Feb 4, 2026
9720efb
Add opaque api key validation logic
Feb 5, 2026
a1e02a7
Fix compilation error
Feb 6, 2026
215b395
Add display name to api key generate rest API
Feb 6, 2026
e4efd6e
Add improvements while testing
Feb 6, 2026
dde5824
Fix issues in JMS event publishing and receiving
Feb 8, 2026
34d8c4b
Fix license headers
Feb 8, 2026
d136ce1
Fix import auto correction issues
Feb 10, 2026
ef07022
Fix review comments
Feb 10, 2026
1afd055
Fix AI review comments
Feb 10, 2026
d3d41bd
Fix review comments and did changes to admin rest apis
Feb 12, 2026
31af582
Add API bound API key rest API definitions
Feb 13, 2026
7b99f76
Add API bound API key related changes
Feb 19, 2026
06c1f31
Add admin rest API changes
Feb 19, 2026
30f2e57
Add untrackted file changes
Feb 19, 2026
65e0503
Add api key association related event handling
Feb 21, 2026
c1310c4
Remove unused secret
Feb 21, 2026
3982305
Add coderabbitai suggestions
Feb 21, 2026
90fb0ee
Change key display name to key name
Feb 23, 2026
f9def1f
Remove associatedOn and add timestamp as lastUsedTime
Feb 24, 2026
1b35ac0
Add keyName to the payload and removed from path params and modify re…
Feb 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.wso2.carbon.apimgt.api.model.API;
import org.wso2.carbon.apimgt.api.model.APIIdentifier;
import org.wso2.carbon.apimgt.api.model.APIKey;
import org.wso2.carbon.apimgt.api.model.APIKeyInfo;
import org.wso2.carbon.apimgt.api.model.APIRating;
import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment;
import org.wso2.carbon.apimgt.api.model.AccessTokenInfo;
Expand Down Expand Up @@ -614,11 +615,23 @@ AccessTokenInfo renewAccessToken(String oldAccessToken, String clientId, String
* @param validityPeriod Requested validity period for the api key.
* @param permittedIP Permitted IP addresses for the api key.
* @param permittedReferer Permitted referrers for the api key.
* @param keyDisplayName Display name of the api key.
* @return Generated api key.
* @throws APIManagementException
*/
String generateApiKey(Application application, String userName, long validityPeriod, String permittedIP,
String permittedReferer)
String permittedReferer, String keyDisplayName)
throws APIManagementException;

/**
* Returns a list of api keys for a given application key type.
*
* @param applicationId Application Id of the application.
* @param keyType Key type of the api keys
* @return A List of api keys.
* @throws APIManagementException This is the custom exception class for API management.
*/
List<APIKeyInfo> getApiKeys(String applicationId, String keyType)
throws APIManagementException;

/**
Expand Down Expand Up @@ -704,6 +717,27 @@ ResourceFile getWSDL(API api, String environmentName, String environmentType, St

void revokeAPIKey(String apiKey, long expiryTime, String tenantDomain) throws APIManagementException;

/**
* Revoke opaque api key and delete from the DB
* @param applicationId Id of the application
* @param keyType Key type of the token
* @param keyDisplayName Api key name
* @param tenantDomain Tenant domain
* @throws APIManagementException
*/
void revokeAPIKey(String applicationId, String keyType, String keyDisplayName, String tenantDomain) throws APIManagementException;

/**
* Regenerate opaque api key for the given key display name with same properties
* @param applicationId Id of the application
* @param keyType Key type of the token
* @param keyDisplayName Api key name
* @param tenantDomain Tenant domain
* @param username User name
* @throws APIManagementException
*/
APIKeyInfo regenerateAPIKey(String applicationId, String keyType, String keyDisplayName, String tenantDomain, String username) throws APIManagementException;

/**
* Updates the details of the specified user application.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/*
* Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.apimgt.api.model;

import java.util.Map;

public class APIKeyInfo {
private String keyDisplayName;
private int appId;
private String applicationId;
private String keyType;
private String lastUsedTime;
private String createdTime;
private String salt;
private String lookupKey;
private long validityPeriod;
private byte[] properties;
private Map<String, String> additionalProperties;
private String apiKeyHash;
private String apiKey;
private String authUser;
private String status;

public String getKeyDisplayName() {
return keyDisplayName;
}

public void setKeyDisplayName(String keyDisplayName) {
this.keyDisplayName = keyDisplayName;
}

public int getAppId() {
return appId;
}

public void setAppId(int appId) {
this.appId = appId;
}

public String getApplicationId() {
return applicationId;
}

public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}

public String getKeyType() {
return keyType;
}

public void setKeyType(String keyType) {
this.keyType = keyType;
}

public String getLastUsedTime() {
return lastUsedTime;
}

public void setLastUsedTime(String lastUsedTime) {
this.lastUsedTime = lastUsedTime;
}

public String getCreatedTime() {
return createdTime;
}

public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}

public String getSalt() {
return salt;
}

public void setSalt(String salt) {
this.salt = salt;
}

public String getLookupKey() {
return lookupKey;
}

public void setLookupKey(String lookupKey) {
this.lookupKey = lookupKey;
}

public long getValidityPeriod() {
return validityPeriod;
}

public void setValidityPeriod(long validityPeriod) {
this.validityPeriod = validityPeriod;
}

public byte[] getProperties() {
return properties;
}

public void setProperties(byte[] properties) {
this.properties = properties;
}

public Map<String, String> getAdditionalProperties() {
return additionalProperties;
}

public void setAdditionalProperties(Map<String, String> additionalProperties) {
this.additionalProperties = additionalProperties;
}

public String getApiKeyHash() {
return apiKeyHash;
}

public void setApiKeyHash(String apiKeyHash) {
this.apiKeyHash = apiKeyHash;
}

public String getApiKey() {
return apiKey;
}

public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}

public String getAuthUser() {
return authUser;
}

public void setAuthUser(String authUser) {
this.authUser = authUser;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public enum EventPublisherType {
CACHE_INVALIDATION,
GLOBAL_CACHE_INVALIDATION,
TOKEN_REVOCATION,
API_KEY_USAGE,
API_KEY_INFO,
ASYNC_WEBHOOKS,
ORGANIZATION_PURGE,
LLMPROVIDER_EVENT
Expand Down
Loading
Loading