
org.cloudfoundry.identity.uaa.oauth.ClientRefreshTokenValidity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudfoundry-identity-server
Show all versions of cloudfoundry-identity-server
Cloud Foundry User Account and Authentication
package org.cloudfoundry.identity.uaa.oauth;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.cloudfoundry.identity.uaa.zone.ClientServicesExtension;
import org.cloudfoundry.identity.uaa.zone.IdentityZoneHolder;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientRegistrationException;
public class ClientRefreshTokenValidity implements ClientTokenValidity {
private final Log logger = LogFactory.getLog(getClass());
private ClientServicesExtension clientServicesExtension;
public ClientRefreshTokenValidity(ClientServicesExtension clientServicesExtension) {
this.clientServicesExtension = clientServicesExtension;
}
@Override
public Integer getValiditySeconds(String clientId) {
ClientDetails clientDetails;
try {
clientDetails = clientServicesExtension.loadClientByClientId(clientId, IdentityZoneHolder.get().getId());
} catch (ClientRegistrationException e) {
logger.info("Could not load details for client " + clientId, e);
return null;
}
return clientDetails.getRefreshTokenValiditySeconds();
}
@Override
public Integer getZoneValiditySeconds() {
return IdentityZoneHolder.get().getConfig().getTokenPolicy().getRefreshTokenValidity();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy