Search in sources :

Example 1 with ClientSecurityManager

use of it.unibo.arces.wot.sepa.commons.security.ClientSecurityManager in project SEPA by arces-wot.

the class ConfigurationProvider method buildSecurityManager.

private ClientSecurityManager buildSecurityManager() throws SEPASecurityException, SEPAPropertiesException {
    ClientSecurityManager sm = null;
    if (appProfile.isSecure()) {
        sm = new ClientSecurityManager(appProfile.getAuthenticationProperties());
        if (!appProfile.getAuthenticationProperties().isClientRegistered()) {
            Response ret = sm.registerClient(getClientId(), appProfile.getAuthenticationProperties().getUsername(), appProfile.getAuthenticationProperties().getInitialAccessToken());
            if (ret.isError())
                throw new SEPASecurityException(getClientId() + " registration failed");
        }
        sm.refreshToken();
        appProfile.getAuthenticationProperties().storeProperties();
    }
    return sm;
}
Also used : Response(it.unibo.arces.wot.sepa.commons.response.Response) SEPASecurityException(it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException) ClientSecurityManager(it.unibo.arces.wot.sepa.commons.security.ClientSecurityManager)

Aggregations

SEPASecurityException (it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException)1 Response (it.unibo.arces.wot.sepa.commons.response.Response)1 ClientSecurityManager (it.unibo.arces.wot.sepa.commons.security.ClientSecurityManager)1