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

com.flyfish.oauth.entry.scribe.SecurityServerApi Maven / Gradle / Ivy

package com.flyfish.oauth.entry.scribe;

import com.flyfish.oauth.configuration.OAuth2SsoProperties;
import com.github.scribejava.core.builder.api.DefaultApi20;
import com.github.scribejava.core.httpclient.HttpClient;
import com.github.scribejava.core.httpclient.HttpClientConfig;
import com.github.scribejava.core.oauth.OAuth20Service;

/**
 * 内部配置类
 *
 * @author wangyu
 */
public class SecurityServerApi extends DefaultApi20 {

    private OAuth2SsoProperties properties;

    public SecurityServerApi(OAuth2SsoProperties properties) {
        this.properties = properties;
    }

    @Override
    public String getAccessTokenEndpoint() {
        return properties.getAccessTokenUri();
    }

    @Override
    public String getRevokeTokenEndpoint() {
        return properties.getUserLogoutUri();
    }

    @Override
    protected String getAuthorizationBaseUrl() {
        return properties.getUserAuthorizationUri();
    }

    public OAuth2SsoProperties getProperties() {
        return this.properties;
    }

    @Override
    public OAuth20Service createService(String apiKey, String apiSecret, String callback, String defaultScope,
                                        String responseType, String userAgent, HttpClientConfig httpClientConfig, HttpClient httpClient) {
        return new DynamicOAuth20Service(this, apiKey, apiSecret, callback, defaultScope, responseType, userAgent, httpClientConfig, httpClient);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy