protected function uma_resource_set($url, $name = null, $icon = null, $scopes = null)
 {
     $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->setRedirectURL($url);
     if (Session::has('uma_auth_pat')) {
         $oidc->setAccessToken(Session::get('uma_auth_pat'));
     } else {
         $oidc->authenticate(true, 'pat');
         Session::put('uma_auth_pat', $oidc->getAccessToken());
     }
     $response = $oidc->resource_set($name, $icon, $scopes);
     return $response;
 }
 public function oidc_logout()
 {
     $open_id_url = 'https://noshchartingsystem.com/openid-connect-server-webapp/';
     $practice = DB::table('practiceinfo')->where('practice_id', '=', '1')->first();
     $client_id = $practice->uma_client_id;
     $client_secret = $practice->uma_client_secret;
     $url = route('oidc_logout');
     $oidc = new OpenIDConnectClient($open_id_url, $client_id, $client_secret);
     $oidc->setRedirectURL($url);
     $oidc->setAccessToken(Session::get('oidc_auth_access_token'));
     $oidc->revoke();
     Session::forget('oidc_auth_access_token');
     return Redirect::intended('logout');
 }
 protected function uma_api_build($command, $url, $send_object = null, $put_delete = null)
 {
     //$open_id_url = 'http://162.243.111.18/uma-server-webapp/';
     $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;
     //$api_endpoint = 'http://162.243.111.18/uma-server-webapp/api/' . $command;
     $api_endpoint = str_replace('/nosh', '/uma-server-webapp/api/' . $command, URL::to('/'));
     $oidc = new OpenIDConnectClient($open_id_url, $client_id, $client_secret);
     $oidc->setRedirectURL($url);
     $oidc->setAccessToken(Session::get('uma_auth_access_token'));
     $response = $oidc->api($command, $api_endpoint, $send_object, $put_delete);
     return $response;
 }