<?php
namespace User\Controller;

use User\Common\SSOHelper;
use Think\Controller;

class SSOBrokerController extends Controller
{
    public function index()
    {
        $ticket = $_GET['ticket'];
        if (empty($ticket)) {
            exit('not login');
        }

        list($user, $redirect_url) = SSOHelper::check_ticket($ticket);
        session('sso_auth_user', $user);
        session('sso_auth_timestamp', time() + 30 * 60);
        redirect($redirect_url);
    }
}