use of org.apache.cxf.rs.security.oauth.data.Token in project cxf by apache.
the class SampleOAuthDataProvider method removeRegisteredClient.
public synchronized void removeRegisteredClient(String consumerKey) {
List<String> registeredApps = this.userRegisteredClients.get(consumerKey);
this.clientAuthInfo.remove(consumerKey);
// remove registered app
registeredApps.remove(consumerKey);
this.userRegisteredClients.put(consumerKey, registeredApps);
// remove all authorized apps from other clients
for (Map.Entry<String, List<String>> userAuthorizedClientsSet : userAuthorizedClients.entrySet()) {
String principalName = userAuthorizedClientsSet.getKey();
List<String> clients = userAuthorizedClientsSet.getValue();
clients.remove(consumerKey);
userAuthorizedClients.put(principalName, clients);
}
// remove access tokens
for (Token token : oauthTokens.values()) {
Client authNInfo = token.getClient();
if (consumerKey.equals(authNInfo.getConsumerKey())) {
oauthTokens.remove(token.getTokenKey());
}
}
}