bantenprov /
bantenprov-sso
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * @Author: jdi-juma |
||
| 5 | * @Date: 2017-12-09 16:45:17 |
||
| 6 | * @Last Modified by: jdi-juma |
||
| 7 | * @Last Modified time: 2017-12-09 23:19:33 |
||
| 8 | */ |
||
| 9 | |||
| 10 | |||
| 11 | namespace Bantenprov\BantenprovSso; |
||
| 12 | |||
| 13 | |||
| 14 | class BantenprovSso |
||
| 15 | { |
||
| 16 | |||
| 17 | public static $result; |
||
| 18 | public static $profile_result; |
||
| 19 | public static $status; |
||
| 20 | public static $request; |
||
| 21 | public static $fails; |
||
| 22 | public static $check_login; |
||
| 23 | public static $token_access; |
||
| 24 | |||
| 25 | public function __construct() |
||
| 26 | { |
||
| 27 | Self::$fails = false; |
||
| 28 | Self::$profile_fails = false; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 29 | Self::$token_access = false; |
||
| 30 | $this->profile = ''; |
||
|
0 ignored issues
–
show
|
|||
| 31 | } |
||
| 32 | |||
| 33 | |||
| 34 | static function Attempt($post) |
||
|
0 ignored issues
–
show
|
|||
| 35 | { |
||
| 36 | $post['appid'] = env('APPID'); |
||
| 37 | $post['token'] = env('TOKEN'); |
||
| 38 | $curl=curl_init(); |
||
| 39 | curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); |
||
| 40 | curl_setopt($curl,CURLOPT_URL,env('SSO_LOGIN')); |
||
| 41 | curl_setopt($curl,CURLOPT_POST,1); |
||
| 42 | curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
||
| 43 | curl_setopt($curl,CURLOPT_TIMEOUT,20); |
||
| 44 | curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
||
| 45 | 'Accept: application/json') |
||
| 46 | ); |
||
| 47 | $exec=curl_exec($curl); |
||
| 48 | if(!$exec) |
||
| 49 | { |
||
| 50 | return BantenprovSso::$fails = true; |
||
| 51 | } |
||
| 52 | curl_close($curl); |
||
| 53 | $result = json_decode($exec); |
||
| 54 | BantenprovSso::$result = $result; |
||
| 55 | return $result->status; |
||
| 56 | } |
||
| 57 | |||
| 58 | static function message() |
||
|
0 ignored issues
–
show
|
|||
| 59 | { |
||
| 60 | return BantenprovSso::$result->message; |
||
| 61 | } |
||
| 62 | |||
| 63 | View Code Duplication | static function check_logout($post) |
|
|
0 ignored issues
–
show
|
|||
| 64 | { |
||
| 65 | $post['appid'] = env('APPID'); |
||
| 66 | $post['token'] = env('TOKEN'); |
||
| 67 | $curl=curl_init(); |
||
| 68 | curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); |
||
| 69 | curl_setopt($curl,CURLOPT_URL,env('CHECK_LOGOUT')); |
||
| 70 | curl_setopt($curl,CURLOPT_POST,1); |
||
| 71 | curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
||
| 72 | curl_setopt($curl,CURLOPT_TIMEOUT,20); |
||
| 73 | curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
||
| 74 | 'Accept: application/json') |
||
| 75 | ); |
||
| 76 | $exec=curl_exec($curl); |
||
| 77 | if(!$exec) |
||
| 78 | { |
||
| 79 | return false; |
||
| 80 | } |
||
| 81 | curl_close($curl); |
||
| 82 | $result = json_decode($exec); |
||
| 83 | return $result->status; |
||
| 84 | } |
||
| 85 | |||
| 86 | View Code Duplication | static function check_login($post) |
|
|
0 ignored issues
–
show
|
|||
| 87 | { |
||
| 88 | $post['appid'] = env('APPID'); |
||
| 89 | $post['token'] = env('TOKEN'); |
||
| 90 | $curl=curl_init(); |
||
| 91 | curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); |
||
| 92 | curl_setopt($curl,CURLOPT_URL,env('CHECK_LOGIN')); |
||
| 93 | curl_setopt($curl,CURLOPT_POST,1); |
||
| 94 | curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
||
| 95 | curl_setopt($curl,CURLOPT_TIMEOUT,20); |
||
| 96 | curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
||
| 97 | 'Accept: application/json') |
||
| 98 | ); |
||
| 99 | $exec=curl_exec($curl); |
||
| 100 | |||
| 101 | //dd($exec); |
||
| 102 | |||
| 103 | if(!$exec) |
||
| 104 | { |
||
| 105 | return false; |
||
| 106 | } |
||
| 107 | curl_close($curl); |
||
| 108 | $result = json_decode($exec); |
||
| 109 | BantenprovSso::$check_login = $result; |
||
| 110 | return $result->status; |
||
| 111 | } |
||
| 112 | |||
| 113 | static function check_login_data() |
||
|
0 ignored issues
–
show
|
|||
| 114 | { |
||
| 115 | return BantenprovSso::$check_login->data; |
||
| 116 | } |
||
| 117 | |||
| 118 | static function data() |
||
|
0 ignored issues
–
show
|
|||
| 119 | { |
||
| 120 | if( BantenprovSso::$result->status == false) |
||
| 121 | { |
||
| 122 | return BantenprovSso::$result->message; |
||
| 123 | } |
||
| 124 | return BantenprovSso::$result->data; |
||
| 125 | |||
| 126 | } |
||
| 127 | |||
| 128 | View Code Duplication | static function Logout($post) |
|
|
0 ignored issues
–
show
|
|||
| 129 | { |
||
| 130 | $post['appid'] = env('APPID'); |
||
| 131 | $post['token'] = env('TOKEN'); |
||
| 132 | $curl=curl_init(); |
||
| 133 | curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); |
||
| 134 | curl_setopt($curl,CURLOPT_URL,env('SSO_LOGOUT')); |
||
| 135 | curl_setopt($curl,CURLOPT_POST,1); |
||
| 136 | curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
||
| 137 | curl_setopt($curl,CURLOPT_TIMEOUT,20); |
||
| 138 | curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
||
| 139 | 'Accept: application/json') |
||
| 140 | ); |
||
| 141 | $exec=curl_exec($curl); |
||
| 142 | //dd($exec); |
||
| 143 | if(!$exec) |
||
| 144 | { |
||
| 145 | return false; |
||
| 146 | } |
||
| 147 | curl_close($curl); |
||
| 148 | $result = json_decode($exec); |
||
| 149 | BantenprovSso::$check_login = $result; |
||
| 150 | return $result->status; |
||
| 151 | } |
||
| 152 | |||
| 153 | static function InitAddress() |
||
|
0 ignored issues
–
show
|
|||
| 154 | { |
||
| 155 | $ipaddress = ''; |
||
| 156 | if (getenv('HTTP_CLIENT_IP')) |
||
| 157 | $ipaddress = getenv('HTTP_CLIENT_IP'); |
||
| 158 | else if(getenv('HTTP_X_FORWARDED_FOR')) |
||
| 159 | $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); |
||
| 160 | else if(getenv('HTTP_X_FORWARDED')) |
||
| 161 | $ipaddress = getenv('HTTP_X_FORWARDED'); |
||
| 162 | else if(getenv('HTTP_FORWARDED_FOR')) |
||
| 163 | $ipaddress = getenv('HTTP_FORWARDED_FOR'); |
||
| 164 | else if(getenv('HTTP_FORWARDED')) |
||
| 165 | $ipaddress = getenv('HTTP_FORWARDED'); |
||
| 166 | else if(getenv('REMOTE_ADDR')) |
||
| 167 | $ipaddress = getenv('REMOTE_ADDR'); |
||
| 168 | else |
||
| 169 | $ipaddress = 'UNKNOWN'; |
||
| 170 | return $ipaddress; |
||
| 171 | } |
||
| 172 | |||
| 173 | static function init() |
||
|
0 ignored issues
–
show
|
|||
| 174 | { |
||
| 175 | return 'package loaded'; |
||
| 176 | } |
||
| 177 | |||
| 178 | } |