Search in sources :

Example 6 with IAuthorizationContext

use of com.openshift.restclient.authorization.IAuthorizationContext in project jbosstools-openshift by jbosstools.

the class Connection method setToken.

public void setToken(String token) {
    IAuthorizationContext context = client.getAuthorizationContext();
    String old = context.getToken();
    context.setToken(token);
    firePropertyChange(SECURE_STORAGE_TOKEN_KEY, old, token);
    this.tokenLoaded = true;
}
Also used : IAuthorizationContext(com.openshift.restclient.authorization.IAuthorizationContext)

Example 7 with IAuthorizationContext

use of com.openshift.restclient.authorization.IAuthorizationContext in project jbosstools-openshift by jbosstools.

the class Connection method loadAuthorizationContext.

private IAuthorizationContext loadAuthorizationContext() {
    IAuthorizationContext context = client.getAuthorizationContext();
    synchronized (context) {
        if (!passwordLoaded) {
            setPassword(load(SECURE_STORAGE_PASSWORD_KEY));
            setRememberPassword(context.getPassword() != null);
        }
        if (!tokenLoaded) {
            setToken(load(SECURE_STORAGE_TOKEN_KEY));
            // potential conflict with load password?
            setRememberToken(context.getToken() != null);
        }
    }
    return context;
}
Also used : IAuthorizationContext(com.openshift.restclient.authorization.IAuthorizationContext)

Aggregations

IAuthorizationContext (com.openshift.restclient.authorization.IAuthorizationContext)7 IClient (com.openshift.restclient.IClient)1 UnauthorizedException (com.openshift.restclient.authorization.UnauthorizedException)1 IConnection (org.jboss.tools.openshift.common.core.connection.IConnection)1 Test (org.junit.Test)1