package com.qmth.teachcloud.cas.util.sxmu;

import com.qmth.teachcloud.exchange.common.contant.SystemConstant;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class CasUtils {

    /**
     * 获取登出地址
     */
    public static String getLogoutUrl(String schoolServiceAddress) throws UnsupportedEncodingException {
        // 获取本次请求的根Path
        String loginUrlRoot = SystemConstant.getBasePath() + Constants.SSO_LOGIN_URI;
        String encodeLoginUrlRoot = URLEncoder.encode(loginUrlRoot, StandardCharsets.UTF_8.toString());
        return schoolServiceAddress + Constants.CAS_LOGOUT_URL + SystemConstant.GET_UNKNOWN + SystemConstant.SERVICE_KEY + SystemConstant.GET_EQUAL + encodeLoginUrlRoot;
    }
}
