Source

Grails Spring Security Taobao / grails-app / controllers / test / TestController.groovy

Full commit
package test

import com.mingidea.security.util.HttpUtils
import groovyx.net.http.HTTPBuilder
import org.springframework.security.authentication.BadCredentialsException


class TestController {
    def springSecurityService
    def concurrentSessionFilter
    def index = {
        String code = params.code
        String url = 'https://gw.open.china.alibaba.com/openapi/http/1/system.oauth2/getToken/1003921'

        String json = HttpUtils.post(url, 'grant_type=authorization_code&need_refresh_token=true&client_id=1003921&client_secret=z3-a:jDFBT]&redirect_uri=http://dev.mingidea.com:8080/spring-security-taobao/test&code=' + code)

        render json
    }


    private String encodeUrl(String url) {
        try {
            return URLEncoder.encode(url, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }

    def expire = {
        def userId = 1

    }

    def p = {
        println concurrentSessionFilter
    }
}