protected function uma_introspect($token)
 {
     $open_id_url = str_replace('/nosh', '/uma-server-webapp/', URL::to('/'));
     $practice = DB::table('practiceinfo')->where('practice_id', '=', '1')->first();
     $client_id = $practice->uma_client_id;
     $client_secret = $practice->uma_client_secret;
     $oidc = new OpenIDConnectClient($open_id_url, $client_id, $client_secret);
     $oidc->refresh($practice->uma_refresh_token, true);
     $response = $oidc->introspect($token);
     return $response;
 }
Exemple #2
0
});
Route::filter('auth.basic', function () {
    return Auth::onceBasic('username');
});
Route::filter('auth.token', function () {
    $payload = Request::header('Authorization');
    $open_id_url = str_replace('/nosh', '/uma-server-webapp/', URL::to('/'));
    $practice = DB::table('practiceinfo')->where('practice_id', '=', '1')->first();
    $client_id = $practice->uma_client_id;
    $client_secret = $practice->uma_client_secret;
    if ($payload) {
        // RPT, Perform Token Introspection
        $rpt = str_replace('Bearer ', '', $payload);
        $oidc = new OpenIDConnectClient($open_id_url, $client_id, $client_secret);
        $oidc->refresh($practice->uma_refresh_token, true);
        $result_rpt = $oidc->introspect($rpt);
        if ($result_rpt['active'] == false) {
            // Inactive RPT, Request Permission Ticket
            $url = Request::url();
            $query = DB::table('uma')->where('scope', '=', $url)->first();
            $as_uri = str_replace('/nosh', '/uma-server-webapp/', URL::to('/'));
            $header = ['WWW-Authenticate' => 'UMA realm="pNOSH_UMA", as_uri="' . $as_uri . '"'];
            $statusCode = 403;
            if ($query) {
                // Look for additional scopes for resource_set_id
                $query1 = DB::table('uma')->where('resource_set_id', '=', $query->resource_set_id)->get();
                $scopes = array();
                foreach ($query1 as $row1) {
                    $scopes[] = $row1->scope;
                }
                $oidc = new OpenIDConnectClient($open_id_url, $client_id, $client_secret);