package ink.wgink.properties.oauth2.client;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @ClassName: OAuth2ClientProperties
 * @Description: OAuth2客户端配置
 * @Author: wanggeng
 * @Date: 2021/9/16 2:38 下午
 * @Version: 1.0
 */
@Component
@ConfigurationProperties(prefix = "security.oauth2")
public class OAuth2ClientProperties {

    private String oauthServer;
    private String oauthLogout;
    private ClientProperties client;

    public String getOauthServer() {
        return oauthServer == null ? "" : oauthServer.trim();
    }

    public void setOauthServer(String oauthServer) {
        this.oauthServer = oauthServer;
    }

    public String getOauthLogout() {
        return oauthLogout == null ? "" : oauthLogout.trim();
    }

    public void setOauthLogout(String oauthLogout) {
        this.oauthLogout = oauthLogout;
    }

    public ClientProperties getClient() {
        return client;
    }

    public void setClient(ClientProperties client) {
        this.client = client;
    }

    @Component
    @ConfigurationProperties(prefix = "security.oauth2.client")
    public static class ClientProperties {
        private String clientId;
        private String clientSecret;
        private String userAuthorizationUri;
        private String accessTokenUri;
        private String grantType;

        public String getClientId() {
            return clientId == null ? "" : clientId.trim();
        }

        public void setClientId(String clientId) {
            this.clientId = clientId;
        }

        public String getClientSecret() {
            return clientSecret == null ? "" : clientSecret.trim();
        }

        public void setClientSecret(String clientSecret) {
            this.clientSecret = clientSecret;
        }

        public String getUserAuthorizationUri() {
            return userAuthorizationUri == null ? "" : userAuthorizationUri.trim();
        }

        public void setUserAuthorizationUri(String userAuthorizationUri) {
            this.userAuthorizationUri = userAuthorizationUri;
        }

        public String getAccessTokenUri() {
            return accessTokenUri == null ? "" : accessTokenUri.trim();
        }

        public void setAccessTokenUri(String accessTokenUri) {
            this.accessTokenUri = accessTokenUri;
        }

        public String getGrantType() {
            return grantType == null ? "" : grantType.trim();
        }

        public void setGrantType(String grantType) {
            this.grantType = grantType;
        }
    }


}
