Changeset 3084002
- Timestamp:
- 05/09/2024 01:39:03 PM (19 months ago)
- Location:
- mobile-bankid-integration/trunk
- Files:
-
- 21 added
- 2 deleted
- 21 edited
-
assets/certs/prod_cacert.cer (added)
-
assets/certs/testenv.p12 (deleted)
-
assets/js/setup.full.js (modified) (2 diffs)
-
assets/js/setup.js (modified) (1 diff)
-
includes/admin/class-admin.php (modified) (9 diffs)
-
includes/class-activation.php (modified) (1 diff)
-
includes/class-core.php (modified) (9 diffs)
-
includes/class-session.php (modified) (2 diffs)
-
includes/settings/class-api.php (modified) (3 diffs)
-
includes/settings/views/setup-configuration.php (modified) (2 diffs)
-
includes/settings/views/setup.php (modified) (1 diff)
-
includes/wp-login/class-api.php (modified) (4 diffs)
-
includes/wp-login/class-login.php (modified) (1 diff)
-
mobile-bankid-integration.php (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_classmap.php (modified) (2 diffs)
-
vendor/composer/autoload_psr4.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (2 diffs)
-
vendor/composer/autoload_static.php (modified) (8 diffs)
-
vendor/composer/installed.json (modified) (5 diffs)
-
vendor/composer/installed.php (modified) (5 diffs)
-
vendor/dimafe6 (deleted)
-
vendor/ljsystem (added)
-
vendor/ljsystem/bankid (added)
-
vendor/ljsystem/bankid/.gitignore (added)
-
vendor/ljsystem/bankid/LICENSE (added)
-
vendor/ljsystem/bankid/README.md (added)
-
vendor/ljsystem/bankid/certs (added)
-
vendor/ljsystem/bankid/certs/README.md (added)
-
vendor/ljsystem/bankid/certs/test.pem (added)
-
vendor/ljsystem/bankid/certs/test_cacert.cer (added)
-
vendor/ljsystem/bankid/composer.json (added)
-
vendor/ljsystem/bankid/config (added)
-
vendor/ljsystem/bankid/config/bankid.php (added)
-
vendor/ljsystem/bankid/lang (added)
-
vendor/ljsystem/bankid/lang/en (added)
-
vendor/ljsystem/bankid/lang/en/bankid.php (added)
-
vendor/ljsystem/bankid/lang/sv (added)
-
vendor/ljsystem/bankid/lang/sv/bankid.php (added)
-
vendor/ljsystem/bankid/src (added)
-
vendor/ljsystem/bankid/src/BankID.php (added)
-
vendor/ljsystem/bankid/src/BankIDResponse.php (added)
-
vendor/symfony/deprecation-contracts/composer.json (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
mobile-bankid-integration/trunk/assets/js/setup.full.js
r3070283 r3084002 58 58 59 59 function configureSubmit() { 60 // Check if all required fields are filled61 if (!document.getElementById('mobile-bankid-integration-endpoint').value) {62 alert(mobile_bankid_integration_setup_localization.endpoint_required);63 return false;64 }65 60 if (!document.getElementById('mobile-bankid-integration-certificate').value) { 66 61 alert(mobile_bankid_integration_setup_localization.certificate_required); … … 87 82 88 83 formdata = new FormData(); 89 formdata.append('endpoint', document.getElementById('mobile-bankid-integration-endpoint').value);90 84 formdata.append('certificate', document.getElementById('mobile-bankid-integration-certificate').value); 91 85 formdata.append('password', document.getElementById('mobile-bankid-integration-password').value); -
mobile-bankid-integration/trunk/assets/js/setup.js
r3070283 r3084002 1 document.getElementById("adminmenumain").remove();document.getElementById("wpadminbar").remove();document.getElementById("wpfooter").remove();document.getElementById("screen-meta").remove();function nextStep(){step=document.getElementById("wizard-content").attributes.step.value;if(step<4){for(i in document.getElementById("wizard-content").getElementsByTagName("button")){document.getElementById("wizard-content").getElementsByTagName("button")[i].disabled=true}for(i in document.getElementById("wizard-content").getElementsByTagName("input")){document.getElementById("wizard-content").getElementsByTagName("input")[i].disabled=true}document.getElementsByClassName("steps")[0].children[0].children[step-1].classList.add("done");document.getElementsByClassName("steps")[0].children[0].children[step-1].classList.remove("active");document.getElementsByClassName("steps")[0].children[0].children[step-1].classList.add("animate-done");document.getElementsByClassName("steps")[0].children[0].children[step].classList.add("active");document.getElementsByClassName("steps")[0].children[0].children[step].classList.add("animate-active");step++;setTimeout(function(){window.location.search+="&step="+step},500)}else{console.log("nextStep() can't be used on last step.")}}function requireconfirmation(id,confirmationText){document.getElementById("wizard-modal-confirmation-text").innerHTML=confirmationText+"<br><br>"+mobile_bankid_integration_setup_localization.confirmation_abort_text;document.getElementById("wizard-modal-abort").setAttribute("onclick",'abortconfirmation("'+id+'")');document.getElementById("wizard-modal-confirm").setAttribute("onclick",'confirmconfirmation("'+id+'")');document.getElementById("wizard-modal-abort").removeAttribute("disabled");document.getElementById("wizard-modal-confirm").removeAttribute("disabled");document.getElementById("wizard-modal").style.display="block"}function abortconfirmation(id=null){if(id!=null){document.getElementById(id).checked=false}document.getElementById("wizard-modal").style.display="none"}function confirmconfirmation(id){document.getElementById("wizard-modal-abort").setAttribute("disabled","disabled");document.getElementById("wizard-modal-confirm").setAttribute("disabled","disabled");if(id=="mobile-bankid-integration-testenv"){autoconfiguretestenv()}document.getElementById("wizard-modal").style.display="none"}function configureSubmit(){if(!document.getElementById("mobile-bankid-integration- endpoint").value){alert(mobile_bankid_integration_setup_localization.endpoint_required);return false}if(!document.getElementById("mobile-bankid-integration-certificate").value){alert(mobile_bankid_integration_setup_localization.certificate_required);return false}if(!document.getElementById("mobile-bankid-integration-password").value){alert(mobile_bankid_integration_setup_localization.password_required);return false}var xhr=new XMLHttpRequest;xhr.open("POST",mobile_bankid_integration_rest_api+"/configuration",true);xhr.setRequestHeader("X-WP-Nonce",mobile_bankid_integration_rest_api_nonce);xhr.onload=function(){if(this.status==200){nextStep()}else{response=JSON.parse(this.responseText);alert(mobile_bankid_integration_setup_localization.configuration_failed+response["message"])}};formdata=new FormData;formdata.append("endpoint",document.getElementById("mobile-bankid-integration-endpoint").value);formdata.append("certificate",document.getElementById("mobile-bankid-integration-certificate").value);formdata.append("password",document.getElementById("mobile-bankid-integration-password").value);xhr.send(formdata)}function settingsSubmit(){var xhr=new XMLHttpRequest;xhr.open("POST",mobile_bankid_integration_rest_api+"/setup_settings",true);xhr.setRequestHeader("X-WP-Nonce",mobile_bankid_integration_rest_api_nonce);xhr.onload=function(){if(this.status==200){nextStep()}else{response=JSON.parse(this.responseText);alert(mobile_bankid_integration_setup_localization.configuration_failed+response["message"])}};formdata=new FormData;formdata.append("wplogin",document.getElementById("mobile-bankid-integration-wplogin").value);formdata.append("registration",document.getElementById("mobile-bankid-integration-registration").value);xhr.send(formdata)}function autoconfiguretestenv(){var xhr=new XMLHttpRequest;xhr.open("GET",mobile_bankid_integration_rest_api+"/autoconfiguretestenv",true);xhr.setRequestHeader("X-WP-Nonce",mobile_bankid_integration_rest_api_nonce);xhr.onload=function(){if(this.status==200){nextStep()}else{alert(mobile_bankid_integration_setup_localization.testenv_autoconfig_failed);document.getElementById("mobile-bankid-integration-testenv").checked=false}};xhr.send()}mobile_bankid_integration_testenv=document.getElementById("mobile-bankid-integration-testenv");if(mobile_bankid_integration_testenv){mobile_bankid_integration_testenv.addEventListener("click",function(){if(this.checked){requireconfirmation("mobile-bankid-integration-testenv",mobile_bankid_integration_setup_localization.testenv_confirmation_text)}})}1 document.getElementById("adminmenumain").remove();document.getElementById("wpadminbar").remove();document.getElementById("wpfooter").remove();document.getElementById("screen-meta").remove();function nextStep(){step=document.getElementById("wizard-content").attributes.step.value;if(step<4){for(i in document.getElementById("wizard-content").getElementsByTagName("button")){document.getElementById("wizard-content").getElementsByTagName("button")[i].disabled=true}for(i in document.getElementById("wizard-content").getElementsByTagName("input")){document.getElementById("wizard-content").getElementsByTagName("input")[i].disabled=true}document.getElementsByClassName("steps")[0].children[0].children[step-1].classList.add("done");document.getElementsByClassName("steps")[0].children[0].children[step-1].classList.remove("active");document.getElementsByClassName("steps")[0].children[0].children[step-1].classList.add("animate-done");document.getElementsByClassName("steps")[0].children[0].children[step].classList.add("active");document.getElementsByClassName("steps")[0].children[0].children[step].classList.add("animate-active");step++;setTimeout(function(){window.location.search+="&step="+step},500)}else{console.log("nextStep() can't be used on last step.")}}function requireconfirmation(id,confirmationText){document.getElementById("wizard-modal-confirmation-text").innerHTML=confirmationText+"<br><br>"+mobile_bankid_integration_setup_localization.confirmation_abort_text;document.getElementById("wizard-modal-abort").setAttribute("onclick",'abortconfirmation("'+id+'")');document.getElementById("wizard-modal-confirm").setAttribute("onclick",'confirmconfirmation("'+id+'")');document.getElementById("wizard-modal-abort").removeAttribute("disabled");document.getElementById("wizard-modal-confirm").removeAttribute("disabled");document.getElementById("wizard-modal").style.display="block"}function abortconfirmation(id=null){if(id!=null){document.getElementById(id).checked=false}document.getElementById("wizard-modal").style.display="none"}function confirmconfirmation(id){document.getElementById("wizard-modal-abort").setAttribute("disabled","disabled");document.getElementById("wizard-modal-confirm").setAttribute("disabled","disabled");if(id=="mobile-bankid-integration-testenv"){autoconfiguretestenv()}document.getElementById("wizard-modal").style.display="none"}function configureSubmit(){if(!document.getElementById("mobile-bankid-integration-certificate").value){alert(mobile_bankid_integration_setup_localization.certificate_required);return false}if(!document.getElementById("mobile-bankid-integration-password").value){alert(mobile_bankid_integration_setup_localization.password_required);return false}var xhr=new XMLHttpRequest;xhr.open("POST",mobile_bankid_integration_rest_api+"/configuration",true);xhr.setRequestHeader("X-WP-Nonce",mobile_bankid_integration_rest_api_nonce);xhr.onload=function(){if(this.status==200){nextStep()}else{response=JSON.parse(this.responseText);alert(mobile_bankid_integration_setup_localization.configuration_failed+response["message"])}};formdata=new FormData;formdata.append("certificate",document.getElementById("mobile-bankid-integration-certificate").value);formdata.append("password",document.getElementById("mobile-bankid-integration-password").value);xhr.send(formdata)}function settingsSubmit(){var xhr=new XMLHttpRequest;xhr.open("POST",mobile_bankid_integration_rest_api+"/setup_settings",true);xhr.setRequestHeader("X-WP-Nonce",mobile_bankid_integration_rest_api_nonce);xhr.onload=function(){if(this.status==200){nextStep()}else{response=JSON.parse(this.responseText);alert(mobile_bankid_integration_setup_localization.configuration_failed+response["message"])}};formdata=new FormData;formdata.append("wplogin",document.getElementById("mobile-bankid-integration-wplogin").value);formdata.append("registration",document.getElementById("mobile-bankid-integration-registration").value);xhr.send(formdata)}function autoconfiguretestenv(){var xhr=new XMLHttpRequest;xhr.open("GET",mobile_bankid_integration_rest_api+"/autoconfiguretestenv",true);xhr.setRequestHeader("X-WP-Nonce",mobile_bankid_integration_rest_api_nonce);xhr.onload=function(){if(this.status==200){nextStep()}else{alert(mobile_bankid_integration_setup_localization.testenv_autoconfig_failed);document.getElementById("mobile-bankid-integration-testenv").checked=false}};xhr.send()}mobile_bankid_integration_testenv=document.getElementById("mobile-bankid-integration-testenv");if(mobile_bankid_integration_testenv){mobile_bankid_integration_testenv.addEventListener("click",function(){if(this.checked){requireconfirmation("mobile-bankid-integration-testenv",mobile_bankid_integration_setup_localization.testenv_confirmation_text)}})} -
mobile-bankid-integration/trunk/includes/admin/class-admin.php
r3070283 r3084002 1 1 <?php 2 2 3 namespace Mobile_BankID_Integration; 3 4 … … 10 11 */ 11 12 class Admin { 13 12 14 13 15 /** … … 92 94 public function redirect_to_setup_if_incomplete() { 93 95 if ( get_admin_page_parent() === 'mobile-bankid-integration' ) { 94 if ( ! ( get_option( 'mobile_bankid_integration_ certificate' ) && get_option( 'mobile_bankid_integration_password' ) && get_option( 'mobile_bankid_integration_endpoint' ) ) ) {96 if ( ! ( get_option( 'mobile_bankid_integration_env' ) && get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) ) ) { 95 97 // Redirect to setup wizard. 96 98 wp_safe_redirect( home_url() . '/wp-admin/admin.php?page=mobile-bankid-integration-setup' ); … … 112 114 Session::admin_notice(); // Show admin notice if session secret is not set. 113 115 114 $current_tab = isset( $_GET['tab']) ? $_GET['tab'] : null; // phpcs:ignore -- Sanitization not needed as it is used in array_key_exists().116 $current_tab = isset($_GET['tab']) ? $_GET['tab'] : null; // phpcs:ignore -- Sanitization not needed as it is used in array_key_exists(). 115 117 if ( ! isset( $current_tab ) || ! array_key_exists( $current_tab, self::$tabs ) ) { 116 118 $current_tab = array_key_first( self::$tabs ); … … 140 142 */ 141 143 private function page_settings() { 144 $env = get_option( 'mobile_bankid_integration_env' ); 142 145 ?> 143 <form autocomplete="off"> 144 <h2><?php esc_html_e( 'Basic configuration', 'mobile-bankid-integration' ); ?></h2> 145 <p class="description"><?php esc_html_e( 'These settings can only be changed by running the setup wizard again.', 'mobile-bankid-integration' ); ?></p> 146 <div class="form-group"> 147 <label for="mobile-bankid-integration-endpoint"><?php esc_html_e( 'API Endpoint', 'mobile-bankid-integration' ); ?></label> 148 <input type="text" name="mobile-bankid-integration-endpoint" id="mobile-bankid-integration-endpoint" disabled readonly value="<?php echo esc_url( get_option( 'mobile_bankid_integration_endpoint' ) ); ?>"> 149 </div> 150 <div class="form-group"> 151 <label for="mobile-bankid-integration-certificate"><?php esc_html_e( 'Certificate location (absolute path)', 'mobile-bankid-integration' ); ?></label> 152 <input type="text" name="mobile-bankid-integration-certificate" id="mobile-bankid-integration-certificate" disabled readonly value="<?php echo esc_attr( get_option( 'mobile_bankid_integration_certificate' ) ); ?>"> 153 </div> 154 <div class="form-group"> 155 <label for="mobile-bankid-integration-password"><?php esc_html_e( 'Certificate password', 'mobile-bankid-integration' ); ?></label> 156 <input type="password" name="mobile-bankid-integration-password" id="mobile-bankid-integration-password" autocomplete="off" disabled readonly value="<?php echo get_option( 'mobile_bankid_integration_password' ) ? '************' : '';?>"> 157 </div> 158 159 <h2><?php esc_html_e( 'Login page', 'mobile-bankid-integration' ); ?></h2> 160 <div class="form-group"> 161 <label for="mobile-bankid-integration-wplogin"><?php esc_html_e( 'Show BankID on login page', 'mobile-bankid-integration' ); ?></label> 162 <select name="mobile-bankid-integration-wplogin" id="mobile-bankid-integration-wplogin"> 163 <option value="as_alternative" 146 <form autocomplete="off"> 147 <h2><?php esc_html_e( 'Basic configuration', 'mobile-bankid-integration' ); ?></h2> 164 148 <?php 165 if ( get_option( 'mobile_bankid_integration_wplogin' ) === 'as_alternative' ) { 166 echo 'selected'; } 149 if ( 'production' === $env ) { 150 ?> 151 <p class="description"><?php esc_html_e( 'These settings can only be changed by running the setup wizard again.', 'mobile-bankid-integration' ); ?></p> 152 <div class="form-group"> 153 <label for="mobile-bankid-integration-certificate"><?php esc_html_e( 'Certificate location (absolute path)', 'mobile-bankid-integration' ); ?></label> 154 <input type="text" name="mobile-bankid-integration-certificate" id="mobile-bankid-integration-certificate" disabled readonly value="<?php echo esc_attr( get_option( 'mobile_bankid_integration_certificate' ) ); ?>"> 155 </div> 156 <div class="form-group"> 157 <label for="mobile-bankid-integration-password"><?php esc_html_e( 'Certificate password', 'mobile-bankid-integration' ); ?></label> 158 <input type="password" name="mobile-bankid-integration-password" id="mobile-bankid-integration-password" autocomplete="off" disabled readonly value="<?php echo get_option( 'mobile_bankid_integration_password' ) ? '************' : ''; ?>"> 159 </div> 160 <?php 161 } else { 162 ?> 163 <p class="description"><?php esc_html_e( 'The plugin is configured for test environment. To change this, run the setup wizard again.', 'mobile-bankid-integration' ); ?></p> 164 <?php 165 } 167 166 ?> 168 ><?php esc_html_e( 'Show as alternative to traditional login', 'mobile-bankid-integration' ); ?></option> 169 <option value="hide" 170 <?php 171 if ( get_option( 'mobile_bankid_integration_wplogin' ) === 'hide' ) { 172 echo 'selected'; } 173 ?> 174 ><?php esc_html_e( 'Do not show at all', 'mobile-bankid-integration' ); ?></option> 175 </select> 176 </div><br> 177 <div class="form-group"> 178 <label for="mobile-bankid-integration-registration"><?php esc_html_e( 'Allow registration with BankID', 'mobile-bankid-integration' ); ?></label> 179 <select name="mobile-bankid-integration-registration" id="mobile-bankid-integration-registration"> 180 <option value="yes" 181 <?php 182 if ( get_option( 'mobile_bankid_integration_registration' ) === 'yes' ) { 183 echo 'selected'; } 184 ?> 185 ><?php esc_html_e( 'Yes', 'mobile-bankid-integration' ); ?></option> 186 <option value="no" 187 <?php 188 if ( get_option( 'mobile_bankid_integration_registration' ) === 'no' ) { 189 echo 'selected'; } 190 ?> 191 ><?php esc_html_e( 'No', 'mobile-bankid-integration' ); ?></option> 192 </select> 193 <p class="description"><?php esc_html_e( 'This setting does not affect, nor is affected by, the native "Allow registration" setting.', 'mobile-bankid-integration' ); ?></p> 194 </div> 195 <div class="form-group"> 196 <label for="mobile-bankid-integration-terms"><?php esc_html_e( 'Terms to show with login (Supports HTML)', 'mobile-bankid-integration' ); ?></label> 197 <textarea name="mobile-bankid-integration-terms" id="mobile-bankid-integration-terms" rows="5"><?php // phpcs:ignore -- PHP tag needed to prevent whitespace in textarea. 198 echo wp_kses( 199 get_option( 'mobile_bankid_integration_terms', __( 'By logging in using Mobile BankID you agree to our Terms of Service and Privacy Policy.', 'mobile-bankid-integration' ) ), 200 array( 201 'a' => array( 202 'href' => array(), 203 'title' => array(), 204 'target' => array(), 205 ), 206 'br' => array(), 207 'em' => array(), 208 'strong' => array(), 209 'i' => array(), 210 ) 211 ); 212 // phpcs:ignore -- PHP tag needed to prevent whitespace in textarea.?></textarea> 213 <p class="description"><?php esc_html_e( 'Following HTML elements are supported: a, br, em, strong and i. All others will be escaped.', 'mobile-bankid-integration' ); ?></p> 214 </div> 215 </form> 216 <button class="button button-primary" onclick="settingsSubmit()" id="mobile-bankid-integration-save"><?php esc_html_e( 'Save changes', 'mobile-bankid-integration' ); ?></button> 217 <style> 218 form { 219 width: fit-content; 220 } 221 form .description { 222 /* Line break when description is too long */ 223 max-width: 500px; 224 word-break: break-word; 225 } 226 .form-group { 227 margin-bottom: 1rem; 228 box-sizing: border-box; 229 width: 100%; 230 } 231 .form-group label { 232 font-weight: bold; 233 display: block; 234 margin-bottom: 0.5rem; 235 } 236 .form-group input[type="text"], 237 .form-group input[type="password"], 238 .form-group textarea { 239 width: 100%; 240 padding: 0.5rem; 241 border: 1px solid #ddd; 242 border-radius: 0.25rem; 243 background-color: #fff; 244 font-size: 1rem; 245 line-height: 1.2; 246 -webkit-appearance: none; 247 -moz-appearance: none; 248 appearance: none; 249 resize: none; 250 } 251 .form-group select { 252 width: 100%; 253 padding: 0.5rem; 254 border: 1px solid #ddd; 255 border-radius: 0.25rem; 256 background-color: #fff; 257 font-size: 1rem; 258 line-height: 1.2; 259 -webkit-appearance: none; 260 -moz-appearance: none; 261 appearance: none; 262 } 263 </style> 264 <script> 265 function settingsSubmit() { 266 document.getElementById("mobile-bankid-integration-save").innerHTML = "<?php esc_html_e( 'Saving...', 'mobile-bankid-integration' ); ?>"; 267 document.getElementById("mobile-bankid-integration-save").disabled = true; 268 var wplogin = document.getElementById("mobile-bankid-integration-wplogin").value; 269 var registration = document.getElementById("mobile-bankid-integration-registration").value; 270 var terms = document.getElementById("mobile-bankid-integration-terms").value; 271 272 var xhr = new XMLHttpRequest(); 273 xhr.open("POST", "<?php echo esc_url( rest_url( 'mobile-bankid-integration/v1/settings' ) ) . '/settings'; ?>", true); 274 xhr.setRequestHeader("X-WP-Nonce", "<?php echo esc_attr( wp_create_nonce( 'wp_rest' ) ); ?>"); 275 276 xhr.onload = function() { 277 if (this.status == 200) { 278 document.getElementById("mobile-bankid-integration-save").innerHTML = "<?php esc_html_e( 'Saved!', 'mobile-bankid-integration' ); ?>"; 279 setTimeout(function() { 280 document.getElementById("mobile-bankid-integration-save").innerHTML = "<?php esc_html_e( 'Save changes', 'mobile-bankid-integration' ); ?>"; 281 document.getElementById("mobile-bankid-integration-save").disabled = false; 282 }, 2000); 283 } else { 284 response = JSON.parse(this.responseText); 285 alert(mobile_bankid_integration_setup_localization.configuration_failed + response['message']); 286 } 287 } 288 289 formdata = new FormData(); 290 formdata.append("wplogin", wplogin); 291 formdata.append("registration", registration); 292 formdata.append("terms", terms); 293 294 xhr.send(formdata); 295 } 296 </script> 167 168 <h2><?php esc_html_e( 'Login page', 'mobile-bankid-integration' ); ?></h2> 169 <div class="form-group"> 170 <label for="mobile-bankid-integration-wplogin"><?php esc_html_e( 'Show BankID on login page', 'mobile-bankid-integration' ); ?></label> 171 <select name="mobile-bankid-integration-wplogin" id="mobile-bankid-integration-wplogin"> 172 <option value="as_alternative" 173 <?php 174 if ( get_option( 'mobile_bankid_integration_wplogin' ) === 'as_alternative' ) { 175 echo 'selected'; 176 } 177 ?> 178 ><?php esc_html_e( 'Show as alternative to traditional login', 'mobile-bankid-integration' ); ?></option> 179 <option value="hide" 180 <?php 181 if ( get_option( 'mobile_bankid_integration_wplogin' ) === 'hide' ) { 182 echo 'selected'; 183 } 184 ?> 185 ><?php esc_html_e( 'Do not show at all', 'mobile-bankid-integration' ); ?></option> 186 </select> 187 </div><br> 188 <div class="form-group"> 189 <label for="mobile-bankid-integration-registration"><?php esc_html_e( 'Allow registration with BankID', 'mobile-bankid-integration' ); ?></label> 190 <select name="mobile-bankid-integration-registration" id="mobile-bankid-integration-registration"> 191 <option value="yes" 192 <?php 193 if ( get_option( 'mobile_bankid_integration_registration' ) === 'yes' ) { 194 echo 'selected'; 195 } 196 ?> 197 ><?php esc_html_e( 'Yes', 'mobile-bankid-integration' ); ?></option> 198 <option value="no" 199 <?php 200 if ( get_option( 'mobile_bankid_integration_registration' ) === 'no' ) { 201 echo 'selected'; 202 } 203 ?> 204 ><?php esc_html_e( 'No', 'mobile-bankid-integration' ); ?></option> 205 </select> 206 <p class="description"><?php esc_html_e( 'This setting does not affect, nor is affected by, the native "Allow registration" setting.', 'mobile-bankid-integration' ); ?></p> 207 </div> 208 <div class="form-group"> 209 <label for="mobile-bankid-integration-terms"><?php esc_html_e( 'Terms to show with login (Supports HTML)', 'mobile-bankid-integration' ); ?></label> 210 <textarea name="mobile-bankid-integration-terms" id="mobile-bankid-integration-terms" rows="5"><?php // phpcs:ignore -- PHP tag needed to prevent whitespace in textarea. 211 echo wp_kses( 212 get_option( 'mobile_bankid_integration_terms', __( 'By logging in using Mobile BankID you agree to our Terms of Service and Privacy Policy.', 'mobile-bankid-integration' ) ), 213 array( 214 'a' => array( 215 'href' => array(), 216 'title' => array(), 217 'target' => array(), 218 ), 219 'br' => array(), 220 'em' => array(), 221 'strong' => array(), 222 'i' => array(), 223 ) 224 ); 225 // phpcs:ignore -- PHP tag needed to prevent whitespace in textarea. 226 ?></textarea> 227 <p class="description"><?php esc_html_e( 'Following HTML elements are supported: a, br, em, strong and i. All others will be escaped.', 'mobile-bankid-integration' ); ?></p> 228 </div> 229 </form> 230 <button class="button button-primary" onclick="settingsSubmit()" id="mobile-bankid-integration-save"><?php esc_html_e( 'Save changes', 'mobile-bankid-integration' ); ?></button> 231 <style> 232 form { 233 width: fit-content; 234 } 235 236 form .description { 237 /* Line break when description is too long */ 238 max-width: 500px; 239 word-break: break-word; 240 } 241 242 .form-group { 243 margin-bottom: 1rem; 244 box-sizing: border-box; 245 width: 100%; 246 } 247 248 .form-group label { 249 font-weight: bold; 250 display: block; 251 margin-bottom: 0.5rem; 252 } 253 254 .form-group input[type="text"], 255 .form-group input[type="password"], 256 .form-group textarea { 257 width: 100%; 258 padding: 0.5rem; 259 border: 1px solid #ddd; 260 border-radius: 0.25rem; 261 background-color: #fff; 262 font-size: 1rem; 263 line-height: 1.2; 264 -webkit-appearance: none; 265 -moz-appearance: none; 266 appearance: none; 267 resize: none; 268 } 269 270 .form-group select { 271 width: 100%; 272 padding: 0.5rem; 273 border: 1px solid #ddd; 274 border-radius: 0.25rem; 275 background-color: #fff; 276 font-size: 1rem; 277 line-height: 1.2; 278 -webkit-appearance: none; 279 -moz-appearance: none; 280 appearance: none; 281 } 282 </style> 283 <script> 284 function settingsSubmit() { 285 document.getElementById("mobile-bankid-integration-save").innerHTML = "<?php esc_html_e( 'Saving...', 'mobile-bankid-integration' ); ?>"; 286 document.getElementById("mobile-bankid-integration-save").disabled = true; 287 var wplogin = document.getElementById("mobile-bankid-integration-wplogin").value; 288 var registration = document.getElementById("mobile-bankid-integration-registration").value; 289 var terms = document.getElementById("mobile-bankid-integration-terms").value; 290 291 var xhr = new XMLHttpRequest(); 292 xhr.open("POST", "<?php echo esc_url( rest_url( 'mobile-bankid-integration/v1/settings' ) ) . '/settings'; ?>", true); 293 xhr.setRequestHeader("X-WP-Nonce", "<?php echo esc_attr( wp_create_nonce( 'wp_rest' ) ); ?>"); 294 295 xhr.onload = function() { 296 if (this.status == 200) { 297 document.getElementById("mobile-bankid-integration-save").innerHTML = "<?php esc_html_e( 'Saved!', 'mobile-bankid-integration' ); ?>"; 298 setTimeout(function() { 299 document.getElementById("mobile-bankid-integration-save").innerHTML = "<?php esc_html_e( 'Save changes', 'mobile-bankid-integration' ); ?>"; 300 document.getElementById("mobile-bankid-integration-save").disabled = false; 301 }, 2000); 302 } else { 303 response = JSON.parse(this.responseText); 304 alert(mobile_bankid_integration_setup_localization.configuration_failed + response['message']); 305 } 306 } 307 308 formdata = new FormData(); 309 formdata.append("wplogin", wplogin); 310 formdata.append("registration", registration); 311 formdata.append("terms", terms); 312 313 xhr.send(formdata); 314 } 315 </script> 297 316 <?php 298 317 } … … 344 363 margin-left: 5px; 345 364 } 365 346 366 .mobile-bankid-integration-integration { 347 367 display: flex; … … 353 373 max-width: 300px; 354 374 } 375 355 376 .mobile-bankid-integration-integration__logo { 356 377 display: flex; … … 359 380 margin-bottom: 20px; 360 381 } 382 361 383 .mobile-bankid-integration-integration__logo img { 362 384 max-width: 100%; 363 385 height: 50px; 364 386 } 387 365 388 .mobile-bankid-integration-integration__title { 366 389 margin-top: 0; 367 390 } 391 368 392 .mobile-bankid-integration-integration__description { 369 393 margin-bottom: 20px; 370 394 } 395 371 396 .coming-soon { 372 397 background: #e5e5e5; … … 396 421 color: rgb(201, 97, 152); 397 422 } 398 <?php 423 424 <?php 399 425 } 400 426 } -
mobile-bankid-integration/trunk/includes/class-activation.php
r3070283 r3084002 52 52 // Delete DB table. 53 53 global $wpdb; 54 $wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS %s', $wpdb->prefix . 'mobile_bankid_integration_auth_responses' ) ); // phpcs:ignore -- Safe query. 54 $table_name = $wpdb->prefix . 'mobile_bankid_integration_auth_responses'; 55 $wpdb->query( "DROP TABLE IF EXISTS `{$table_name}`" ); 55 56 56 57 // Delete session secret. -
mobile-bankid-integration/trunk/includes/class-core.php
r3070283 r3084002 4 4 defined( 'ABSPATH' ) || exit; // Exit if accessed directly. 5 5 6 use Dimafe6\BankID\Service\BankIDService;6 use LJSystem\BankID\BankID; 7 7 8 8 new Core(); … … 24 24 * BankIDService object. 25 25 * 26 * @var BankID Service|null27 */ 28 private BankID Service$bankid_service;26 * @var BankID|null 27 */ 28 private BankID $bankid_service; 29 29 30 30 /** … … 46 46 */ 47 47 public function init() { 48 if ( get_option( 'mobile_bankid_integration_en dpoint' ) && get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) ) {48 if ( get_option( 'mobile_bankid_integration_env' ) && get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) ) { 49 49 $this->create_bankid_service(); 50 50 do_action( 'mobile_bankid_integration_init' ); … … 58 58 */ 59 59 private function create_bankid_service() { 60 $this->bankid_service = new BankIDService( 61 get_option( 'mobile_bankid_integration_endpoint' ), 62 $_SERVER['REMOTE_ADDR'], // phpcs:ignore -- Does always exist and isn't user input. 63 array( 64 'verify' => false, 65 'cert' => array( get_option( 'mobile_bankid_integration_certificate' ), get_option( 'mobile_bankid_integration_password' ) ), 66 ) 67 ); 60 if ( 'test' === get_option( 'mobile_bankid_integration_env' ) ) { 61 $this->bankid_service = new BankID(); 62 } else { 63 $this->bankid_service = new BankID( 64 BankID::ENVIRONMENT_PRODUCTION, 65 get_option( 'mobile_bankid_integration_certificate' ), 66 MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'assets/certs/prod_cacert.cer', 67 null, 68 get_option( 'mobile_bankid_integration_password' ) 69 ); 70 } 68 71 } 69 72 … … 71 74 * Get BankIDService object. 72 75 * 73 * @return BankID Service76 * @return BankID 74 77 */ 75 78 public function get_bankid_service() { … … 87 90 } 88 91 89 $response = $this->bankid_service-> getAuthResponse();92 $response = $this->bankid_service->authenticate( $_SERVER['REMOTE_ADDR'] ); // phpcs:ignore 90 93 // Save the response in DB. 91 $this->saveAuthResponseToDB( $response-> orderRef, $response ); // phpcs:ignore -- We cannot modify $orderRef to snake_case.94 $this->saveAuthResponseToDB( $response->getOrderRef(), $response->getBody() ); 92 95 return array( 93 'orderRef' => $response-> orderRef, // phpcs:ignore -- We cannot modify $orderRef to snake_case.94 'autoStartToken' => $response-> autoStartToken, // phpcs:ignore -- We cannot modify $autoStartToken to snake_case.96 'orderRef' => $response->getOrderRef(), 97 'autoStartToken' => $response->getAutoStartToken(), 95 98 ); 96 99 } … … 115 118 return array( 116 119 'time_created' => $response->time_created, 117 'response' => $this->convert_json_order_response_to_array( $response->response ),120 'response' => json_decode( $response->response, true ), 118 121 'orderRef' => $response->orderRef, // phpcs:ignore -- We shall not modify $orderRef to snake_case. 119 122 ); … … 134 137 array( 135 138 'time_created' => time(), 136 'response' => $this->convert_order_response_to_json( $response ),139 'response' => wp_json_encode( $response ), 137 140 'orderRef' => $orderRef, // phpcs:ignore -- We shall not modify $orderRef to snake_case. 138 141 ) … … 243 246 $session->destroy(); 244 247 } 245 246 /**247 * Convert Dimafe6\BankID\OrderResponse to json.248 *249 * @param Dimafe6\BankID\OrderResponse $order_response Order response.250 * @return array251 * @since 1.0.1252 */253 private function convert_order_response_to_json( $order_response ): string {254 // Make sure that $order_response is an instance of Dimafe6\BankID\Model\OrderResponse.255 if ( ! $order_response instanceof \Dimafe6\BankID\Model\OrderResponse ) {256 return array();257 }258 $array = array(259 'orderRef' => $order_response->orderRef, // phpcs:ignore -- We shall not modify $orderRef to snake_case.260 'autoStartToken' => $order_response->autoStartToken // phpcs:ignore -- We shall not modify $autoStartToken to snake_case.261 );262 // If property qrStartToken exists, add it to the array.263 if ( property_exists( $order_response, 'qrStartToken' ) ) {264 $array['qrStartToken'] = $order_response->qrStartToken; // phpcs:ignore -- We shall not modify $qrStartToken to snake_case.265 }266 // If property qrStartSecret exists, add it to the array.267 if ( property_exists( $order_response, 'qrStartSecret' ) ) {268 $array['qrStartSecret'] = $order_response->qrStartSecret; // phpcs:ignore -- We shall not modify $qrStartSecret to snake_case.269 }270 271 $json = wp_json_encode( $array );272 273 return $json ? $json : '{}';274 }275 276 /**277 * Convert JSON OrderResponse to array after checking if it is valid.278 *279 * @param string $json JSON OrderResponse.280 * @throws \Exception If JSON or data is not valid.281 * @return array282 * @since 1.0.1283 */284 private function convert_json_order_response_to_array( $json ): array {285 // Check each property in the JSON OrderResponse against [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}286 // If any of the properties is not valid, return an empty array.287 $json = json_decode( $json, true );288 if ( ! is_array( $json ) ) {289 throw new \Exception( 'Invalid JSON' );290 }291 foreach ( $json as $key => $value ) {292 if ( ! preg_match( '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/', $value ) ) {293 throw new \Exception( 'Data is not valid' );294 }295 }296 return $json;297 }298 248 } -
mobile-bankid-integration/trunk/includes/class-session.php
r3070283 r3084002 107 107 */ 108 108 public static function install() { 109 // Include the WordPress filesystem API functions. 110 require_once ABSPATH . 'wp-admin/includes/file.php'; 111 WP_Filesystem(); 112 109 113 // Check if a secret already exists. 110 114 if ( defined( 'MOBILE_BANKID_INTEGRATION_SESSION_SECRET' ) || get_option( 'mobile_bankid_integration_session_secret' ) ) { … … 148 152 */ 149 153 public static function uninstall() { 154 // Include the WordPress filesystem API functions. 155 require_once ABSPATH . 'wp-admin/includes/file.php'; 156 WP_Filesystem(); 157 150 158 // Check if a secret exists. 151 159 if ( ! defined( 'MOBILE_BANKID_INTEGRATION_SESSION_SECRET' ) && ! get_option( 'mobile_bankid_integration_session_secret' ) ) { -
mobile-bankid-integration/trunk/includes/settings/class-api.php
r3070283 r3084002 78 78 public function configuration() { 79 79 // Get params. 80 $endpoint = isset( $_POST['endpoint'] ) ? sanitize_text_field( wp_unslash( $_POST['endpoint'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification81 80 $certificate = isset( $_POST['certificate'] ) ? sanitize_text_field( wp_unslash( $_POST['certificate'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification 82 81 $password = isset( $_POST['password'] ) ? $_POST['password'] : null; // phpcs:ignore 83 82 84 // Check endpoint domain is one of the allowed endpoints.85 if ( ! isset( $endpoint ) || ! preg_match( '/^https:\/\/appapi2\.(test\.)?bankid\.com\/rp\/v5\.1$/', $endpoint ) ) {86 return new \WP_Error( 'invalid_endpoint', esc_html__( 'API Endpoint is not valid.', 'mobile-bankid-integration' ), array( 'status' => 400 ) );87 }88 89 83 // Check that submitted certificate is valid and exists. 90 if ( ! isset( $certificate ) || ! preg_match( '/^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(p 12))$/', $certificate ) ) {84 if ( ! isset( $certificate ) || ! preg_match( '/^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(pem))$/', $certificate ) ) { 91 85 return new \WP_Error( 'invalid_certificate', esc_html__( 'Certificate is not valid.', 'mobile-bankid-integration' ), array( 'status' => 400 ) ); 92 86 } … … 111 105 112 106 // Update the WP options. 107 update_option( 'mobile_bankid_integration_env', 'production' ); 113 108 update_option( 'mobile_bankid_integration_certificate', $certificate ); 114 update_option( 'mobile_bankid_integration_endpoint', $endpoint );115 109 update_option( 'mobile_bankid_integration_password', $password ); 116 110 … … 127 121 */ 128 122 public function auto_configure_test_env() { 129 // Check if certificate exists. 130 $certificate_dir = MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'assets/certs/'; 131 if ( ! file_exists( $certificate_dir . 'testenv.p12' ) ) { 132 return new \WP_Error( 'certificate_does_not_exist', esc_html__( 'Certificate does not exist.', 'mobile-bankid-integration' ), array( 'status' => 400 ) ); 133 } 134 135 // Update the WP options. 136 update_option( 'mobile_bankid_integration_certificate', $certificate_dir . 'testenv.p12' ); 137 update_option( 'mobile_bankid_integration_endpoint', 'https://appapi2.test.bankid.com/rp/v5.1/' ); 138 update_option( 'mobile_bankid_integration_password', 'qwerty123' ); 123 // Update the WP option. 124 update_option( 'mobile_bankid_integration_env', 'test' ); 125 update_option( 'mobile_bankid_integration_certificate', 'test-env' ); 126 update_option( 'mobile_bankid_integration_password', 'test-env' ); 139 127 140 128 return true; -
mobile-bankid-integration/trunk/includes/settings/views/setup-configuration.php
r3070283 r3084002 7 7 <form autocomplete="off"> 8 8 <input autocomplete="false" type="text" name="mobile_bankid_integration_setup" value="1" style="display: none;"> 9 <h2><?php esc_html_e( ' Auto-configuration', 'mobile-bankid-integration' ); ?></h2>9 <h2><?php esc_html_e( 'Test environment', 'mobile-bankid-integration' ); ?></h2> 10 10 <div class="form-group"> 11 11 <label for="mobile-bankid-integration-testenv"><?php esc_html_e( 'Auto-configure for test enviroment', 'mobile-bankid-integration' ); ?></label> … … 13 13 <p class="description"><?php esc_html_e( 'This will configure the plugin for the test enviroment. This is only recommended if you are testing the plugin.', 'mobile-bankid-integration' ); ?></p> 14 14 </div> 15 <h2><?php esc_html_e( ' Manual configuration', 'mobile-bankid-integration' ); ?></h2>15 <h2><?php esc_html_e( 'Production environment', 'mobile-bankid-integration' ); ?></h2> 16 16 <div class="form-group"> 17 <label for="mobile-bankid-integration-endpoint"><?php esc_html_e( 'API Endpoint', 'mobile-bankid-integration' ); ?></label> 18 <input type="url" id="mobile-bankid-integration-endpoint"> 19 <p class="description"> 20 <?php 21 printf( 22 /* translators: %1$s Production API Endpoint, %1$s Test enviroment API Endpoint */ 23 esc_html__( 'The API Endpoint is normally %1$s for production and %2$s for test environment.', 'mobile-bankid-integration' ), 24 '<code>https://appapi2.bankid.com/rp/v5.1</code>', 25 '<code>https://appapi2.test.bankid.com/rp/v5.1</code>' 26 ) 27 ?> 28 </p> 29 </div> 30 <div class="form-group"> 31 <label for="mobile-bankid-integration-certificate"><?php esc_html_e( 'Absolute path to certificate', 'mobile-bankid-integration' ); ?></label> 32 <input type="text" id="mobile-bankid-integration-certificate" placeholder="<?php /* translators: Placeholder path to .p12 certificate. */ esc_attr_e( '/path/to/certificate.p12', 'mobile-bankid-integration' ); ?>"> 17 <label for="mobile-bankid-integration-certificate"><?php esc_html_e( 'Absolute path to certificate (.pem)', 'mobile-bankid-integration' ); ?></label> 18 <input type="text" id="mobile-bankid-integration-certificate" placeholder="<?php /* translators: Placeholder path to .pem certificate. */ esc_attr_e( '/path/to/certificate.pem', 'mobile-bankid-integration' ); ?>"> 33 19 <p class="description"><?php esc_html_e( 'Please note that the certificate shall, for security reasons, not be placed within any publicly accessible directory.', 'mobile-bankid-integration' ); ?></p> 34 20 </div> -
mobile-bankid-integration/trunk/includes/settings/views/setup.php
r3070283 r3084002 2 2 /** 3 3 * Setup view on activation. 4 * 4 * 5 5 * @package mobile-bankid-integration 6 6 */ 7 7 8 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.8 defined( 'ABSPATH' ) || exit; // Exit if accessed directly. 9 9 10 10 $step = isset( $_GET['step'] ) ? $_GET['step'] : 1; // phpcs:ignore -
mobile-bankid-integration/trunk/includes/wp-login/class-api.php
r3070283 r3084002 79 79 $time_since_auth = $time - $db_row['time_created']; 80 80 81 $status = $instance->get_bankid_service()->collect Response( $auth_response['orderRef'] );81 $status = $instance->get_bankid_service()->collect( $_GET['orderRef'] ); // phpcs:ignore 82 82 83 if ( 'failed' === $status->status ) { 83 $status = $status->getBody(); 84 85 if ( 'failed' === $status['status'] ) { 84 86 $instance->deleteAuthResponseFromDB( $order_ref ); 85 87 $return = array( … … 88 90 'time_since_auth' => $time_since_auth, 89 91 'status' => 'failed', 90 'hintCode' => $status ->hintCode, // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase92 'hintCode' => $status['hintCode'], // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 91 93 ); 92 94 return $return; 93 95 } 94 96 95 if ( 'complete' === $status ->status) {97 if ( 'complete' === $status['status'] ) { 96 98 $instance->deleteAuthResponseFromDB( $order_ref ); 97 if ( $this->sign_in_as_user_from_bankid( $status->completionData->user->personalNumber, $status->completionData->user->givenName, $status->completionData->user->surname ) === false ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 99 $create_user = $this->sign_in_as_user_from_bankid( $status['completionData']['user']['personalNumber'], $status['completionData']['user']['givenName'], $status['completionData']['user']['surname'] ); 100 if ( false === $create_user ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 98 101 return array( 99 102 'qr' => null, … … 117 120 'orderRef' => $order_ref, 118 121 'time_since_auth' => $time_since_auth, 119 'status' => $status ->status,120 'hintCode' => $status ->hintCode?? '', // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase122 'status' => $status['status'], 123 'hintCode' => $status['hintCode'] ?? '', // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 121 124 ); 122 125 } … … 158 161 $user_id = $user->ID; 159 162 } 163 wp_clear_auth_cookie(); 160 164 wp_set_current_user( $user_id ); 161 165 wp_set_auth_cookie( $user_id ); -
mobile-bankid-integration/trunk/includes/wp-login/class-login.php
r3070283 r3084002 33 33 * @return void 34 34 */ 35 public function login_button( $redirect = null) {36 if ( null === $redirect) {35 public function login_button( $redirect = '' ) { 36 if ( empty( $redirect ) ) { 37 37 $redirect = '/wp-admin/'; 38 38 } -
mobile-bankid-integration/trunk/mobile-bankid-integration.php
r3070284 r3084002 3 3 Plugin Name: Mobile BankID Integration 4 4 Description: A plugin that allows you to integrate Mobile BankID with your WordPress site. 5 Version: 1. 1.15 Version: 1.2 6 6 Author: Jamie Blomerus 7 7 Author URI: https://github.com/jamieblomerus … … 14 14 15 15 // Define constants. 16 define( 'MOBILE_BANKID_INTEGRATION_VERSION', '1. 1.1' );16 define( 'MOBILE_BANKID_INTEGRATION_VERSION', '1.2' ); 17 17 define( 'MOBILE_BANKID_INTEGRATION_PLUGIN_FILE', __FILE__ ); 18 18 define( 'MOBILE_BANKID_INTEGRATION_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); -
mobile-bankid-integration/trunk/readme.txt
r3070289 r3084002 4 4 Requires at least: 5.2 5 5 Tested up to: 6.5 6 Stable tag: 1. 1.16 Stable tag: 1.2 7 7 Requires PHP: 7.2 8 8 License: GPLv3 or later … … 15 15 This is a plugin that allows you to integrate Mobile BankID with your WordPress site and use it for the following: 16 16 17 - Authenticate users (as an alternative to username and password) 18 - Perform age checks of customers (Woocommerce) 19 - Tailor it to your needs with extensions (Very developer friendly) 20 17 - Authenticate users (as an alternative to username and password) 18 - Perform age checks of customers (Woocommerce) 19 - Tailor it to your needs with extensions (Very developer friendly) 21 20 And more. 22 21 … … 49 48 == Changelog == 50 49 50 = 1.2 = 51 * Added support for API version 6.0 while removing support for API version 5.1. 52 * Fixed some errors being thrown on activation and deactivation of the plugin. 53 51 54 = 1.1.1 = 52 55 * Changed the license of the plugin to GPLv3 or later. … … 72 75 == Upgrade Notice == 73 76 77 = 1.2 = 78 Major update. Requires total reinstallation of the plugin. 79 74 80 = 1.1.1 = 75 81 This update changes the license of the plugin to GPLv3 or later. And fixes a minor problem with translations. -
mobile-bankid-integration/trunk/vendor/autoload.php
r3070283 r3084002 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit f1ee947fd74be7d3fc6011c144f5a4e4::getLoader();25 return ComposerAutoloaderInit841ba1d7db30a331995bbf9dcd7573e3::getLoader(); -
mobile-bankid-integration/trunk/vendor/composer/autoload_classmap.php
r3070283 r3084002 8 8 return array( 9 9 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 10 'Dimafe6\\BankID\\Model\\AbstractResponseModel' => $vendorDir . '/dimafe6/bank-id/src/Model/AbstractResponseModel.php',11 'Dimafe6\\BankID\\Model\\CertInfo' => $vendorDir . '/dimafe6/bank-id/src/Model/CertInfo.php',12 'Dimafe6\\BankID\\Model\\CollectResponse' => $vendorDir . '/dimafe6/bank-id/src/Model/CollectResponse.php',13 'Dimafe6\\BankID\\Model\\CompletionData' => $vendorDir . '/dimafe6/bank-id/src/Model/CompletionData.php',14 'Dimafe6\\BankID\\Model\\DeviceInfo' => $vendorDir . '/dimafe6/bank-id/src/Model/DeviceInfo.php',15 'Dimafe6\\BankID\\Model\\OrderResponse' => $vendorDir . '/dimafe6/bank-id/src/Model/OrderResponse.php',16 'Dimafe6\\BankID\\Model\\UserInfo' => $vendorDir . '/dimafe6/bank-id/src/Model/UserInfo.php',17 'Dimafe6\\BankID\\Service\\BankIDService' => $vendorDir . '/dimafe6/bank-id/src/Service/BankIDService.php',18 10 'GuzzleHttp\\BodySummarizer' => $vendorDir . '/guzzlehttp/guzzle/src/BodySummarizer.php', 19 11 'GuzzleHttp\\BodySummarizerInterface' => $vendorDir . '/guzzlehttp/guzzle/src/BodySummarizerInterface.php', … … 102 94 'GuzzleHttp\\TransferStats' => $vendorDir . '/guzzlehttp/guzzle/src/TransferStats.php', 103 95 'GuzzleHttp\\Utils' => $vendorDir . '/guzzlehttp/guzzle/src/Utils.php', 96 'LJSystem\\BankID\\BankID' => $vendorDir . '/ljsystem/bankid/src/BankID.php', 97 'LJSystem\\BankID\\BankIDResponse' => $vendorDir . '/ljsystem/bankid/src/BankIDResponse.php', 104 98 'Personnummer\\Personnummer' => $vendorDir . '/personnummer/personnummer/src/Personnummer.php', 105 99 'Personnummer\\PersonnummerException' => $vendorDir . '/personnummer/personnummer/src/PersonnummerException.php', -
mobile-bankid-integration/trunk/vendor/composer/autoload_psr4.php
r3070283 r3084002 12 12 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 13 13 'Personnummer\\' => array($vendorDir . '/personnummer/personnummer/src'), 14 'LJSystem\\BankID\\' => array($vendorDir . '/ljsystem/bankid/src'), 14 15 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 15 16 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 16 17 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), 17 'Dimafe6\\BankID\\' => array($vendorDir . '/dimafe6/bank-id/src'),18 18 ); -
mobile-bankid-integration/trunk/vendor/composer/autoload_real.php
r3070283 r3084002 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit f1ee947fd74be7d3fc6011c144f5a4e45 class ComposerAutoloaderInit841ba1d7db30a331995bbf9dcd7573e3 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit f1ee947fd74be7d3fc6011c144f5a4e4', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit841ba1d7db30a331995bbf9dcd7573e3', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit f1ee947fd74be7d3fc6011c144f5a4e4', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit841ba1d7db30a331995bbf9dcd7573e3', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit f1ee947fd74be7d3fc6011c144f5a4e4::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit f1ee947fd74be7d3fc6011c144f5a4e4::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
mobile-bankid-integration/trunk/vendor/composer/autoload_static.php
r3070283 r3084002 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit f1ee947fd74be7d3fc6011c144f5a4e47 class ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3 8 8 { 9 9 public static $files = array ( … … 25 25 'Personnummer\\' => 13, 26 26 ), 27 'L' => 28 array ( 29 'LJSystem\\BankID\\' => 16, 30 ), 27 31 'G' => 28 32 array ( … … 31 35 'GuzzleHttp\\' => 11, 32 36 ), 33 'D' =>34 array (35 'Dimafe6\\BankID\\' => 15,36 ),37 37 ); 38 38 … … 59 59 0 => __DIR__ . '/..' . '/personnummer/personnummer/src', 60 60 ), 61 'LJSystem\\BankID\\' => 62 array ( 63 0 => __DIR__ . '/..' . '/ljsystem/bankid/src', 64 ), 61 65 'GuzzleHttp\\Psr7\\' => 62 66 array ( … … 70 74 array ( 71 75 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', 72 ),73 'Dimafe6\\BankID\\' =>74 array (75 0 => __DIR__ . '/..' . '/dimafe6/bank-id/src',76 76 ), 77 77 ); … … 79 79 public static $classMap = array ( 80 80 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 81 'Dimafe6\\BankID\\Model\\AbstractResponseModel' => __DIR__ . '/..' . '/dimafe6/bank-id/src/Model/AbstractResponseModel.php',82 'Dimafe6\\BankID\\Model\\CertInfo' => __DIR__ . '/..' . '/dimafe6/bank-id/src/Model/CertInfo.php',83 'Dimafe6\\BankID\\Model\\CollectResponse' => __DIR__ . '/..' . '/dimafe6/bank-id/src/Model/CollectResponse.php',84 'Dimafe6\\BankID\\Model\\CompletionData' => __DIR__ . '/..' . '/dimafe6/bank-id/src/Model/CompletionData.php',85 'Dimafe6\\BankID\\Model\\DeviceInfo' => __DIR__ . '/..' . '/dimafe6/bank-id/src/Model/DeviceInfo.php',86 'Dimafe6\\BankID\\Model\\OrderResponse' => __DIR__ . '/..' . '/dimafe6/bank-id/src/Model/OrderResponse.php',87 'Dimafe6\\BankID\\Model\\UserInfo' => __DIR__ . '/..' . '/dimafe6/bank-id/src/Model/UserInfo.php',88 'Dimafe6\\BankID\\Service\\BankIDService' => __DIR__ . '/..' . '/dimafe6/bank-id/src/Service/BankIDService.php',89 81 'GuzzleHttp\\BodySummarizer' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/BodySummarizer.php', 90 82 'GuzzleHttp\\BodySummarizerInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/BodySummarizerInterface.php', … … 173 165 'GuzzleHttp\\TransferStats' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/TransferStats.php', 174 166 'GuzzleHttp\\Utils' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Utils.php', 167 'LJSystem\\BankID\\BankID' => __DIR__ . '/..' . '/ljsystem/bankid/src/BankID.php', 168 'LJSystem\\BankID\\BankIDResponse' => __DIR__ . '/..' . '/ljsystem/bankid/src/BankIDResponse.php', 175 169 'Personnummer\\Personnummer' => __DIR__ . '/..' . '/personnummer/personnummer/src/Personnummer.php', 176 170 'Personnummer\\PersonnummerException' => __DIR__ . '/..' . '/personnummer/personnummer/src/PersonnummerException.php', … … 223 217 { 224 218 return \Closure::bind(function () use ($loader) { 225 $loader->prefixLengthsPsr4 = ComposerStaticInit f1ee947fd74be7d3fc6011c144f5a4e4::$prefixLengthsPsr4;226 $loader->prefixDirsPsr4 = ComposerStaticInit f1ee947fd74be7d3fc6011c144f5a4e4::$prefixDirsPsr4;227 $loader->classMap = ComposerStaticInit f1ee947fd74be7d3fc6011c144f5a4e4::$classMap;219 $loader->prefixLengthsPsr4 = ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::$prefixLengthsPsr4; 220 $loader->prefixDirsPsr4 = ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::$prefixDirsPsr4; 221 $loader->classMap = ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::$classMap; 228 222 229 223 }, null, ClassLoader::class); -
mobile-bankid-integration/trunk/vendor/composer/installed.json
r3070283 r3084002 152 152 ], 153 153 "install-path": "../chillerlan/php-settings-container" 154 },155 {156 "name": "dimafe6/bank-id",157 "version": "2.1.1",158 "version_normalized": "2.1.1.0",159 "source": {160 "type": "git",161 "url": "https://github.com/dimafe6/bank-id.git",162 "reference": "2a47a361aac14c9ef98f3073f02bfe29fe2034e1"163 },164 "dist": {165 "type": "zip",166 "url": "https://api.github.com/repos/dimafe6/bank-id/zipball/2a47a361aac14c9ef98f3073f02bfe29fe2034e1",167 "reference": "2a47a361aac14c9ef98f3073f02bfe29fe2034e1",168 "shasum": ""169 },170 "require": {171 "guzzlehttp/guzzle": "^7.0.1",172 "php": ">=7.2.0 | 8.0.*"173 },174 "require-dev": {175 "phpunit/phpunit": "5.7.* || 6.3.* || 9.5.*"176 },177 "time": "2021-12-16T12:43:27+00:00",178 "type": "library",179 "extra": {180 "branch-alias": {181 "dev-master": "2.0-dev"182 }183 },184 "installation-source": "dist",185 "autoload": {186 "psr-4": {187 "Dimafe6\\BankID\\": "src"188 }189 },190 "notification-url": "https://packagist.org/downloads/",191 "license": [192 "MIT"193 ],194 "authors": [195 {196 "name": "Dmitry Feshchenko",197 "email": "[email protected]"198 },199 {200 "name": "Oleg Davudyuk",201 "email": "[email protected]"202 },203 {204 "name": "Anders Fajerson",205 "email": "[email protected]"206 },207 {208 "name": "Puggan",209 "email": "[email protected]"210 },211 {212 "name": "Sebastian Marcusson",213 "email": "[email protected]"214 }215 ],216 "description": "Library for Swedish BankID",217 "homepage": "https://github.com/dimafe6/bank-id",218 "keywords": [219 "bank-id",220 "dimafe6"221 ],222 "support": {223 "issues": "https://github.com/dimafe6/bank-id/issues",224 "source": "https://github.com/dimafe6/bank-id/tree/2.1.1"225 },226 "install-path": "../dimafe6/bank-id"227 154 }, 228 155 { … … 559 486 ], 560 487 "install-path": "../guzzlehttp/psr7" 488 }, 489 { 490 "name": "ljsystem/bankid", 491 "version": "1.0", 492 "version_normalized": "1.0.0.0", 493 "source": { 494 "type": "git", 495 "url": "https://github.com/ljsystem/bankid.git", 496 "reference": "2177dedf67b8b88771fc4821057d32736e011ec6" 497 }, 498 "dist": { 499 "type": "zip", 500 "url": "https://api.github.com/repos/ljsystem/bankid/zipball/2177dedf67b8b88771fc4821057d32736e011ec6", 501 "reference": "2177dedf67b8b88771fc4821057d32736e011ec6", 502 "shasum": "" 503 }, 504 "require": { 505 "ext-json": "*", 506 "guzzlehttp/guzzle": "^6.3 | ^7.0.1", 507 "php": "^7.1 || ^8.0" 508 }, 509 "time": "2023-07-18T09:23:19+00:00", 510 "type": "library", 511 "installation-source": "dist", 512 "autoload": { 513 "psr-4": { 514 "LJSystem\\BankID\\": "src" 515 } 516 }, 517 "notification-url": "https://packagist.org/downloads/", 518 "license": [ 519 "MIT" 520 ], 521 "description": "Library for the Swedish BankID API", 522 "support": { 523 "issues": "https://github.com/ljsystem/bankid/issues", 524 "source": "https://github.com/ljsystem/bankid/tree/1.0" 525 }, 526 "install-path": "../ljsystem/bankid" 561 527 }, 562 528 { … … 857 823 { 858 824 "name": "symfony/deprecation-contracts", 859 "version": "v3. 4.0",860 "version_normalized": "3. 4.0.0",825 "version": "v3.5.0", 826 "version_normalized": "3.5.0.0", 861 827 "source": { 862 828 "type": "git", 863 829 "url": "https://github.com/symfony/deprecation-contracts.git", 864 "reference": " 7c3aff79d10325257a001fcf92d991f24fc967cf"865 }, 866 "dist": { 867 "type": "zip", 868 "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/ 7c3aff79d10325257a001fcf92d991f24fc967cf",869 "reference": " 7c3aff79d10325257a001fcf92d991f24fc967cf",830 "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" 831 }, 832 "dist": { 833 "type": "zip", 834 "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", 835 "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", 870 836 "shasum": "" 871 837 }, … … 873 839 "php": ">=8.1" 874 840 }, 875 "time": "202 3-05-23T14:45:45+00:00",841 "time": "2024-04-18T09:32:20+00:00", 876 842 "type": "library", 877 843 "extra": { 878 844 "branch-alias": { 879 "dev-main": "3. 4-dev"845 "dev-main": "3.5-dev" 880 846 }, 881 847 "thanks": { … … 907 873 "homepage": "https://symfony.com", 908 874 "support": { 909 "source": "https://github.com/symfony/deprecation-contracts/tree/v3. 4.0"875 "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" 910 876 }, 911 877 "funding": [ -
mobile-bankid-integration/trunk/vendor/composer/installed.php
r3070283 r3084002 4 4 'pretty_version' => 'dev-trunk', 5 5 'version' => 'dev-trunk', 6 'reference' => ' b6f753d77e0b192f4f130b08324e4b00f9e9e273',6 'reference' => '7aedfae704fa281f38077e40019261b06e1964e7', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-trunk', 15 15 'version' => 'dev-trunk', 16 'reference' => ' b6f753d77e0b192f4f130b08324e4b00f9e9e273',16 'reference' => '7aedfae704fa281f38077e40019261b06e1964e7', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', … … 35 35 'type' => 'library', 36 36 'install_path' => __DIR__ . '/../chillerlan/php-settings-container', 37 'aliases' => array(),38 'dev_requirement' => false,39 ),40 'dimafe6/bank-id' => array(41 'pretty_version' => '2.1.1',42 'version' => '2.1.1.0',43 'reference' => '2a47a361aac14c9ef98f3073f02bfe29fe2034e1',44 'type' => 'library',45 'install_path' => __DIR__ . '/../dimafe6/bank-id',46 37 'aliases' => array(), 47 38 'dev_requirement' => false, … … 71 62 'type' => 'library', 72 63 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 64 'aliases' => array(), 65 'dev_requirement' => false, 66 ), 67 'ljsystem/bankid' => array( 68 'pretty_version' => '1.0', 69 'version' => '1.0.0.0', 70 'reference' => '2177dedf67b8b88771fc4821057d32736e011ec6', 71 'type' => 'library', 72 'install_path' => __DIR__ . '/../ljsystem/bankid', 73 73 'aliases' => array(), 74 74 'dev_requirement' => false, … … 138 138 ), 139 139 'symfony/deprecation-contracts' => array( 140 'pretty_version' => 'v3. 4.0',141 'version' => '3. 4.0.0',142 'reference' => ' 7c3aff79d10325257a001fcf92d991f24fc967cf',140 'pretty_version' => 'v3.5.0', 141 'version' => '3.5.0.0', 142 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', 143 143 'type' => 'library', 144 144 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', -
mobile-bankid-integration/trunk/vendor/symfony/deprecation-contracts/composer.json
r3070283 r3084002 26 26 "extra": { 27 27 "branch-alias": { 28 "dev-main": "3. 4-dev"28 "dev-main": "3.5-dev" 29 29 }, 30 30 "thanks": {
Note: See TracChangeset
for help on using the changeset viewer.