forked from wso2-extensions/apim-km-wso2is
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of internal token revocation events.
Added the license header. temp 1. Temp2 Revert "Added the license header." This reverts commit bec1c5e. Revert "Initla implementation of the token persistance event." This reverts commit 4112748. temp3 Temp5 Temp Added code review related changes.
- Loading branch information
1 parent
3ce91ed
commit 9e05abe
Showing
10 changed files
with
190 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...ava/org/wso2/is/key/manager/tokenpersistence/listner/APIMOAuthApplicationMgtListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* WSO2 Inc. 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.is.key.manager.tokenpersistence.listner; | ||
|
||
import org.apache.commons.logging.*; | ||
import org.wso2.carbon.identity.oauth.*; | ||
import org.wso2.carbon.identity.oauth.dto.*; | ||
import org.wso2.carbon.identity.oauth.listener.*; | ||
import org.wso2.is.notification.*; | ||
import org.wso2.is.notification.event.*; | ||
import org.wso2.is.notification.internal.*; | ||
|
||
import java.util.*; | ||
|
||
public class APIMOAuthApplicationMgtListener implements OAuthApplicationMgtListener { | ||
|
||
private static final Log log = LogFactory.getLog(APIMOAuthApplicationMgtListener.class); | ||
|
||
|
||
@Override | ||
public boolean isEnabled() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public int getExecutionOrder() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void doPreUpdateConsumerApplication(OAuthConsumerAppDTO oAuthConsumerAppDTO) throws IdentityOAuthAdminException { | ||
|
||
} | ||
|
||
@Override | ||
public void doPreUpdateConsumerApplicationState(String s, String s1) throws IdentityOAuthAdminException { | ||
|
||
} | ||
|
||
@Override | ||
public void doPreRemoveOAuthApplicationData(String s) throws IdentityOAuthAdminException { | ||
|
||
} | ||
|
||
@Override | ||
public void doPostRevokeRegenerateOAuthSecret(String consumerKey, Properties properties) | ||
throws IdentityOAuthAdminException { | ||
InternalTokenRevocationEvent internalTokenRevocationEvent | ||
= new InternalTokenRevocationEvent(consumerKey, properties); | ||
ServiceReferenceHolder.getInstance().getEventSender().publishEvent(internalTokenRevocationEvent); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...t.handlers/src/main/java/org/wso2/is/notification/event/InternalTokenRevocationEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
|
||
/* | ||
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* WSO2 Inc. 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.is.notification.event; | ||
|
||
import org.wso2.is.notification.*; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
* Token Revocation Event Model to send Event. | ||
*/ | ||
public class InternalTokenRevocationEvent extends Event { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private String revocationTime; | ||
private String consumerKey; | ||
private String revocationType; | ||
|
||
public InternalTokenRevocationEvent(String consumerKey, Properties properties) { | ||
|
||
this.eventId = UUID.randomUUID().toString(); | ||
this.type = NotificationConstants.INTERNAL_TOKEN_REVOCATION_EVENT; | ||
this.consumerKey = consumerKey; | ||
this.revocationTime = String.valueOf(System.currentTimeMillis()); | ||
this.revocationType = (String) properties.getProperty("action"); | ||
|
||
} | ||
|
||
public String getConsumerKey() { | ||
return consumerKey; | ||
} | ||
public void setConsumerKey(String consumerKey) { | ||
|
||
this.consumerKey = consumerKey; | ||
} | ||
|
||
public String getRevocationTime() { | ||
return revocationTime; | ||
} | ||
|
||
public void setRevocationTime(String revocationTime) { | ||
this.revocationTime = revocationTime; | ||
} | ||
|
||
public String getRevocationType() { | ||
return revocationType; | ||
} | ||
|
||
public void setRevocationType(String revocationType) { | ||
this.revocationType = revocationType; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
|
||
return "TokenRevocationEvent{" + | ||
"eventId='" + eventId + '\'' + | ||
", type='" + type + '\'' + | ||
", consumerKey='" + consumerKey + '\'' + | ||
", revocationTime=" + revocationTime + | ||
", revocationType=" + revocationType + | ||
", tenantId=" + tenantId + | ||
", tenantDomain='" + tenantDomain + '\'' + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters