All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.rocketbase.commons.adapters.AuthRestTemplate Maven / Gradle / Ivy

There is a newer version: 4.4.1
Show newest version
package io.rocketbase.commons.adapters;

import io.rocketbase.commons.resource.BasicResponseErrorHandler;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;

public class AuthRestTemplate extends RestTemplate implements RestOperations {

    /**
     * use SecurityContext as source for authentications
     */
    public AuthRestTemplate(AuthClientRequestFactory requestFactory) {
        super(requestFactory);
        init();
    }

    /**
     * login user once and work with it's credentials
     */
    public AuthRestTemplate(AuthClientLoginRequestFactory requestFactory) {
        super(requestFactory);
        init();
    }

    /**
     * login user once and work with it's credentials
     */
    public AuthRestTemplate(String baseAuthApiUrl, String username, String password) {
        super(new AuthClientLoginRequestFactory(baseAuthApiUrl, username, password));
        init();
    }

    protected void init() {
        setErrorHandler(new BasicResponseErrorHandler());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy