use of com.zimbra.soap.account.message.OAuthConsumer in project zm-mailbox by Zimbra.
the class GetOAuthConsumers method createConsumer.
private OAuthConsumer createConsumer(String accessToken, OAuthAccessor accessor) {
OAuthConsumer zcsConsumer = new OAuthConsumer();
zcsConsumer.setAccessToken(accessToken);
zcsConsumer.setApplicationName((String) accessor.consumer.getProperty("app_name"));
zcsConsumer.setApprovedOn((String) accessor.consumer.getProperty("approved_on"));
zcsConsumer.setDevice((String) accessor.consumer.getProperty("device"));
return zcsConsumer;
}
use of com.zimbra.soap.account.message.OAuthConsumer in project zm-mailbox by Zimbra.
the class GetOAuthConsumers method encodeResponse.
private void encodeResponse(Account account, GetOAuthConsumersResponse response) throws ServiceException {
String[] accessors = account.getOAuthAccessor();
OAuthAccessor accessor = null;
for (String val : accessors) {
try {
String accessToken = val.substring(0, val.indexOf("::"));
accessor = new OAuthAccessorSerializer().deserialize(val.substring(val.indexOf("::") + 2));
OAuthConsumer zcsConsumer = createConsumer(accessToken, accessor);
response.addConsumer(zcsConsumer);
} catch (ServiceException e) {
throw AuthProviderException.FAILURE("Error in deserializing OAuth accessor");
}
}
}
Aggregations