[webexteams] Remove the access token when the thing is removed (#14979)

Related to #14818

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2023-05-11 22:03:00 +02:00 committed by GitHub
parent 14e7109a25
commit 88413c001d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,11 +147,17 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe
OAuthClientService authService = this.authService;
if (authService != null) {
authService.removeAccessTokenRefreshListener(this);
oAuthFactory.ungetOAuthService(thing.getUID().getAsString());
}
oAuthFactory.ungetOAuthService(thing.getUID().getAsString());
cancelSchedulers();
}
@Override
public void handleRemoval() {
oAuthFactory.deleteServiceAndAccessToken(thing.getUID().getAsString());
super.handleRemoval();
}
private void createIntegrationOAuthClientService(WebexTeamsConfiguration config) {
String thingUID = this.getThing().getUID().getAsString();
logger.debug("Creating OAuth Client Service for {}", thingUID);
@ -369,7 +375,7 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe
/**
* Send a message to a specific room
*
*
* @param roomId roomId of the room to send to
* @param msg markdown text string to be sent
* @return <code>true</code>, if sending the message has been successful and
@ -385,11 +391,11 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe
/**
* Send a message to a specific room, with attachment
*
*
* @param roomId roomId of the room to send to
* @param msg markdown text string to be sent
* @param attach URL of the attachment
*
*
* @return <code>true</code>, if sending the message has been successful and
* <code>false</code> in all other cases.
*/
@ -404,7 +410,7 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe
/**
* Sends a message to a specific person, identified by email
*
*
* @param personEmail email address of the person to send to
* @param msg markdown text string to be sent
* @return <code>true</code>, if sending the message has been successful and
@ -420,7 +426,7 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe
/**
* Sends a message to a specific person, identified by email, with attachment
*
*
* @param personEmail email address of the person to send to
* @param msg markdown text string to be sent
* @param attach URL of the attachment*
@ -438,7 +444,7 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe
/**
* Sends a <code>Message</code>
*
*
* @param msg the <code>Message</code> to be sent
* @return <code>true</code>, if sending the message has been successful and
* <code>false</code> in all other cases.