388 $this->load->model(
'module/gluu_sso');
389 require_once(DIR_SYSTEM .
'library/oxd-rp/Register_site.php');
390 require_once(DIR_SYSTEM .
'library/oxd-rp/Update_site_registration.php');
391 $base_url = HTTPS_CATALOG;
392 if( isset( $_REQUEST[
'submit'] ) and strpos( $_REQUEST[
'submit'],
'delete' ) !==
false and !empty($_REQUEST[
'submit'])) {
393 $this->model_module_gluu_sso->drop_table();
398 $_SESSION[
'message_success'] =
'Configurations deleted Successfully.';
399 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
402 if( isset( $_REQUEST[
'form_key'] ) and strpos( $_REQUEST[
'form_key'],
'general_register_page' ) !== false ) {
403 if(!isset($_SERVER[
'HTTPS']) or $_SERVER[
'HTTPS'] !=
"on") {
404 $_SESSION[
'message_error'] =
'OpenID Connect requires https. This extension will not work if your website uses http only.';
405 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
408 if($_POST[
'gluu_user_role']){
409 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
410 $gluu_other_config[
'gluu_user_role'] = $_POST[
'gluu_user_role'];
411 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
413 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
414 $gluu_other_config[
'gluu_user_role'] = 0;
415 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
417 if($_POST[
'gluu_users_can_register']==1){
418 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_users_can_register', $_POST[
'gluu_users_can_register']);
419 if(!empty(array_values(array_filter($_POST[
'gluu_new_role'])))){
420 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(array_unique(array_values(array_filter($_POST[
'gluu_new_role'])))));
421 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
422 array_push($config[
'config_scopes'],
'permission');
423 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
425 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(array()));
428 if($_POST[
'gluu_users_can_register']==2){
429 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_users_can_register', 2);
430 if(!empty(array_values(array_filter($_POST[
'gluu_new_role'])))){
431 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(array_unique(array_values(array_filter($_POST[
'gluu_new_role'])))));
432 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
433 array_push($config[
'config_scopes'],
'permission');
434 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
436 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(array()));
439 if($_POST[
'gluu_users_can_register']==3){
440 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_users_can_register', 3);
441 if(!empty(array_values(array_filter($_POST[
'gluu_new_role'])))){
442 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(array_unique(array_values(array_filter($_POST[
'gluu_new_role'])))));
443 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
444 array_push($config[
'config_scopes'],
'permission');
445 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
447 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(array()));
450 if (empty($_POST[
'gluu_oxd_port'])) {
451 $_SESSION[
'message_error'] =
'All the fields are required. Please enter valid entries.';
452 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
455 else if (intval($_POST[
'gluu_oxd_port']) > 65535 && intval($_POST[
'gluu_oxd_port']) < 0) {
456 $_SESSION[
'message_error'] =
'Enter your oxd host port (Min. number 1, Max. number 65535)';
457 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
460 else if (!empty($_POST[
'gluu_provider'])) {
461 if (filter_var($_POST[
'gluu_provider'], FILTER_VALIDATE_URL) ===
false) {
462 $_SESSION[
'message_error'] =
'Please enter valid OpenID Provider URI.';
463 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
467 if(!empty($_POST[
'gluu_custom_logout'])){
468 if (filter_var($_POST[
'gluu_custom_logout'], FILTER_VALIDATE_URL) ===
false) {
469 $_SESSION[
'message_error'] =
'Please enter valid Custom URI.';
471 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
472 $gluu_other_config[
'gluu_custom_logout'] = $_POST[
'gluu_custom_logout'];
473 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
477 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_custom_logout'),
true);
478 $gluu_other_config[
'gluu_custom_logout'] =
'';
479 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
481 if (isset($_POST[
'gluu_provider']) and !empty($_POST[
'gluu_provider'])) {
482 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
483 $gluu_other_config[
'gluu_provider'] = $_POST[
'gluu_provider'];
484 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
485 $arrContextOptions=array(
487 "verify_peer"=>
false,
488 "verify_peer_name"=>
false,
491 $gluu_provider = $gluu_other_config[
'gluu_provider'];
492 $json = file_get_contents($gluu_provider.
'/.well-known/openid-configuration',
false, stream_context_create($arrContextOptions));
493 $obj = json_decode($json);
494 if(!empty($obj->userinfo_endpoint)){
496 if(empty($obj->registration_endpoint)){
497 $_SESSION[
'message_success'] =
"Please enter your client_id and client_secret.";
498 $gluu_config = json_encode(array(
499 "gluu_oxd_port" =>$_POST[
'gluu_oxd_port'],
500 "admin_email" => $this->config->get(
'config_email'),
501 "authorization_redirect_uri" => HTTPS_CATALOG.
'index.php?route=module/gluu_sso/login_by_sso',
502 "post_logout_redirect_uri" => HTTPS_CATALOG.
'index.php?route=account/logout',
503 "config_scopes" => [
"openid",
"profile",
"email"],
504 "gluu_client_id" =>
"",
505 "gluu_client_secret" =>
"",
508 if($_POST[
'gluu_users_can_register']==2){
509 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
510 array_push($config[
'config_scopes'],
'permission');
511 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
513 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', $gluu_config),
true);
514 if(isset($_POST[
'gluu_client_id']) and !empty($_POST[
'gluu_client_id']) and
515 isset($_POST[
'gluu_client_secret']) and !empty($_POST[
'gluu_client_secret'])){
516 $gluu_config = json_encode(array(
517 "gluu_oxd_port" =>$_POST[
'gluu_oxd_port'],
518 "admin_email" => $this->config->get(
'config_email'),
519 "authorization_redirect_uri" => HTTPS_CATALOG.
'index.php?route=module/gluu_sso/login_by_sso',
520 "post_logout_redirect_uri" => HTTPS_CATALOG.
'index.php?route=account/logout',
521 "config_scopes" => [
"openid",
"profile",
"email"],
522 "gluu_client_id" => $_POST[
'gluu_client_id'],
523 "gluu_client_secret" => $_POST[
'gluu_client_secret'],
526 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', $gluu_config),
true);
527 if($_POST[
'gluu_users_can_register']==2){
528 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
529 array_push($config[
'config_scopes'],
'permission');
530 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
533 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
534 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
539 $register_site->setRequestAuthorizationRedirectUri($gluu_config[
'authorization_redirect_uri']);
540 $register_site->setRequestLogoutRedirectUri($gluu_config[
'post_logout_redirect_uri']);
541 $register_site->setRequestContacts([$gluu_config[
'admin_email']]);
542 $register_site->setRequestClientLogoutUri($gluu_config[
'post_logout_redirect_uri']);
543 $get_scopes = json_encode($obj->scopes_supported);
544 if(!empty($obj->acr_values_supported)){
545 $get_acr = json_encode($obj->acr_values_supported);
546 $get_acr = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_acr', $get_acr);
552 if(!empty($obj->scopes_supported)){
553 $get_scopes = json_encode($obj->scopes_supported);
554 $get_scopes = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_scopes', $get_scopes);
560 $register_site->setRequestClientId($gluu_config[
'gluu_client_id']);
561 $register_site->setRequestClientSecret($gluu_config[
'gluu_client_secret']);
563 if(!$status[
'status']){
564 if ($status[
'message'] ==
'invalid_op_host') {
565 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
566 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
569 if (!$status[
'status']) {
570 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
571 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
574 if ($status[
'message'] ==
'internal_error') {
575 $_SESSION[
'message_error'] =
'ERROR: '.$status[
'error_message'];
576 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
583 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
584 $gluu_other_config[
'gluu_oxd_id'] = $gluu_oxd_id;
585 $gluu_other_config[
'gluu_provider'] = $gluu_provider;
586 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
587 $_SESSION[
'message_success'] =
'Your settings are saved successfully.';
588 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
591 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
592 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
597 $_SESSION[
'openid_error'] =
'Error505.';
598 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
604 $gluu_config = json_encode(array(
605 "gluu_oxd_port" =>$_POST[
'gluu_oxd_port'],
606 "admin_email" => $this->config->get(
'config_email'),
607 "authorization_redirect_uri" => HTTPS_CATALOG.
'index.php?route=module/gluu_sso/login_by_sso',
608 "post_logout_redirect_uri" => HTTPS_CATALOG.
'index.php?route=account/logout',
609 "config_scopes" => [
"openid",
"profile",
"email"],
610 "gluu_client_id" =>
"",
611 "gluu_client_secret" =>
"",
614 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', $gluu_config),
true);
615 if($_POST[
'gluu_users_can_register']==2){
616 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
617 array_push($config[
'config_scopes'],
'permission');
618 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
621 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
622 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
626 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
627 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
631 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
632 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
637 $register_site->setRequestAuthorizationRedirectUri($gluu_config[
'authorization_redirect_uri']);
638 $register_site->setRequestLogoutRedirectUri($gluu_config[
'post_logout_redirect_uri']);
639 $register_site->setRequestContacts([$gluu_config[
'admin_email']]);
640 $register_site->setRequestClientLogoutUri($gluu_config[
'post_logout_redirect_uri']);
641 $get_scopes = json_encode($obj->scopes_supported);
642 if(!empty($obj->acr_values_supported)){
643 $get_acr = json_encode($obj->acr_values_supported);
644 $get_acr = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_acr', $get_acr));
650 if(!empty($obj->scopes_supported)){
651 $get_scopes = json_encode($obj->scopes_supported);
652 $get_scopes = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_scopes', $get_scopes));
659 if(!$status[
'status']){
660 if ($status[
'message'] ==
'invalid_op_host') {
661 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
662 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
665 if (!$status[
'status']) {
666 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
667 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
670 if ($status[
'message'] ==
'internal_error') {
671 $_SESSION[
'message_error'] =
'ERROR: '.$status[
'error_message'];
672 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
679 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
680 $gluu_other_config[
'gluu_oxd_id'] = $gluu_oxd_id;
681 $gluu_other_config[
'gluu_provider'] = $gluu_provider;
682 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
683 $_SESSION[
'message_success'] =
'Your settings are saved successfully.';
684 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
688 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
689 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
695 $_SESSION[
'message_error'] =
'Please enter correct URI of the OpenID Provider';
696 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
702 $gluu_config = json_encode(array(
703 "gluu_oxd_port" =>$_POST[
'gluu_oxd_port'],
704 "admin_email" => $this->config->get(
'config_email'),
705 "authorization_redirect_uri" => HTTPS_CATALOG.
'index.php?route=module/gluu_sso/login_by_sso',
706 "post_logout_redirect_uri" => HTTPS_CATALOG.
'index.php?route=account/logout',
707 "config_scopes" => [
"openid",
"profile",
"email"],
708 "gluu_client_id" =>
"",
709 "gluu_client_secret" =>
"",
712 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', $gluu_config),
true);
713 if($_POST[
'gluu_users_can_register']==2){
714 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
715 array_push($config[
'config_scopes'],
'permission');
716 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
719 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
720 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
724 $register_site->setRequestAuthorizationRedirectUri($gluu_config[
'authorization_redirect_uri']);
725 $register_site->setRequestLogoutRedirectUri($gluu_config[
'post_logout_redirect_uri']);
726 $register_site->setRequestContacts([$gluu_config[
'admin_email']]);
729 $register_site->setRequestClientLogoutUri($gluu_config[
'post_logout_redirect_uri']);
732 if(!$status[
'status']){
733 if ($status[
'message'] ==
'invalid_op_host') {
734 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
735 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
738 if (!$status[
'status']) {
739 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
740 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
743 if ($status[
'message'] ==
'internal_error') {
744 $_SESSION[
'message_error'] =
'ERROR: '.$status[
'error_message'];
745 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
752 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
753 $gluu_other_config[
'gluu_oxd_id'] = $gluu_oxd_id;
754 $gluu_other_config[
'gluu_provider'] = $gluu_provider;
755 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
756 $arrContextOptions=array(
758 "verify_peer"=>
false,
759 "verify_peer_name"=>
false,
762 $json = file_get_contents($gluu_provider.
'/.well-known/openid-configuration',
false, stream_context_create($arrContextOptions));
763 $obj = json_decode($json);
765 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
766 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
771 $register_site->setRequestAuthorizationRedirectUri($gluu_config[
'authorization_redirect_uri']);
772 $register_site->setRequestLogoutRedirectUri($gluu_config[
'post_logout_redirect_uri']);
773 $register_site->setRequestContacts([$gluu_config[
'admin_email']]);
774 $register_site->setRequestClientLogoutUri($gluu_config[
'post_logout_redirect_uri']);
776 $get_scopes = json_encode($obj->scopes_supported);
777 if(!empty($obj->acr_values_supported)){
778 $get_acr = json_encode($obj->acr_values_supported);
779 $get_acr = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_acr', $get_acr);
785 if(!empty($obj->scopes_supported)){
786 $get_scopes = json_encode($obj->scopes_supported);
787 $get_scopes = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_scopes', $get_scopes);
794 if(!$status[
'status']){
795 if ($status[
'message'] ==
'invalid_op_host') {
796 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
797 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
800 if (!$status[
'status']) {
801 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
802 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
805 if ($status[
'message'] ==
'internal_error') {
806 $_SESSION[
'message_error'] =
'ERROR: '.$status[
'error_message'];
807 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
813 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
814 $gluu_other_config[
'gluu_oxd_id'] = $gluu_oxd_id;
815 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
816 $_SESSION[
'message_success'] =
'Your settings are saved successfully.';
817 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
821 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
822 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
827 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
828 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
833 else if (isset( $_REQUEST[
'form_key'] ) and strpos( $_REQUEST[
'form_key'],
'general_oxd_edit' ) !==
false) {
835 if($_POST[
'gluu_user_role']){
836 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
837 $gluu_other_config[
'gluu_user_role'] = $_POST[
'gluu_user_role'];
838 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
840 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
841 $gluu_other_config[
'gluu_user_role'] = 0;
842 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
844 if($_POST[
'gluu_users_can_register']==1){
845 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_users_can_register', $_POST[
'gluu_users_can_register']);
846 if(!empty(array_values(array_filter($_POST[
'gluu_new_role'])))){
847 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(array_unique(array_values(array_filter($_POST[
'gluu_new_role'])))));
848 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
849 array_push($config[
'config_scopes'],
'permission');
850 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
852 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(null));
855 if($_POST[
'gluu_users_can_register']==2){
856 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_users_can_register', 2);
858 if(!empty(array_values(array_filter($_POST[
'gluu_new_role'])))){
859 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(array_unique(array_values(array_filter($_POST[
'gluu_new_role'])))));
860 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
861 array_push($config[
'config_scopes'],
'permission');
862 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
864 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(null));
867 if($_POST[
'gluu_users_can_register']==3){
868 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_users_can_register', 3);
869 if(!empty(array_values(array_filter($_POST[
'gluu_new_role'])))){
870 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(array_unique(array_values(array_filter($_POST[
'gluu_new_role'])))));
871 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
872 array_push($config[
'config_scopes'],
'permission');
873 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
875 $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_new_role', json_encode(null));
878 $get_scopes = json_encode(array(
"openid",
"profile",
"email"));
879 $get_scopes = $this->model_module_gluu_sso->gluu_db_query_update(
'get_scopes', $get_scopes);
881 $gluu_acr = json_encode(array(
"none"));
882 $gluu_acr = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_acr', $gluu_acr);
884 if(!isset($_SERVER[
'HTTPS']) or $_SERVER[
'HTTPS'] !=
"on") {
885 $_SESSION[
'message_error'] =
'OpenID Connect requires https. This extension will not work if your website uses http only.';
886 $this->response->redirect($this->url->link(
'module/gluu_sso/edit',
'token=' . $this->session->data[
'token'],
'SSL'));
889 if (empty($_POST[
'gluu_oxd_port'])) {
890 $_SESSION[
'message_error'] =
'All the fields are required. Please enter valid entries.';
891 $this->response->redirect($this->url->link(
'module/gluu_sso/edit',
'token=' . $this->session->data[
'token'],
'SSL'));
894 else if (intval($_POST[
'gluu_oxd_port']) > 65535 && intval($_POST[
'gluu_oxd_port']) < 0) {
895 $_SESSION[
'message_error'] =
'Enter your oxd host port (Min. number 0, Max. number 65535).';
896 $this->response->redirect($this->url->link(
'module/gluu_sso/edit',
'token=' . $this->session->data[
'token'],
'SSL'));
899 if (!empty($_POST[
'gluu_custom_logout'])) {
900 if (filter_var($_POST[
'gluu_custom_logout'], FILTER_VALIDATE_URL) ===
false) {
901 $_SESSION[
'message_error'] =
'Please enter valid Custom URI.';
903 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
904 $gluu_other_config[
'gluu_custom_logout'] = $_POST[
'gluu_custom_logout'];
905 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
908 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
909 $gluu_other_config[
'gluu_custom_logout'] =
'';
910 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
912 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
913 $gluu_other_config[
'gluu_oxd_id'] =
'';
914 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
915 $gluu_config = array(
916 "gluu_oxd_port" =>$_POST[
'gluu_oxd_port'],
917 "admin_email" => $this->config->get(
'config_email'),
918 "authorization_redirect_uri" => HTTPS_CATALOG.
'index.php?route=module/gluu_sso/login_by_sso',
919 "post_logout_redirect_uri" => HTTPS_CATALOG.
'index.php?route=account/logout',
920 "config_scopes" => [
"openid",
"profile",
"email"],
921 "gluu_client_id" =>
"",
922 "gluu_client_secret" =>
"",
926 $gluu_config = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($gluu_config));
927 if($_POST[
'gluu_users_can_register']==2){
928 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
929 array_push($config[
'config_scopes'],
'permission');
930 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
932 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
933 $gluu_provider = $gluu_other_config[
'gluu_provider'];
934 if (!empty($gluu_provider)) {
935 $arrContextOptions=array(
937 "verify_peer"=>
false,
938 "verify_peer_name"=>
false,
941 $json = file_get_contents($gluu_provider.
'/.well-known/openid-configuration',
false, stream_context_create($arrContextOptions));
942 $obj = json_decode($json);
943 if(!empty($obj->userinfo_endpoint)){
944 if(empty($obj->registration_endpoint)){
945 if(isset($_POST[
'gluu_client_id']) and !empty($_POST[
'gluu_client_id']) and
946 isset($_POST[
'gluu_client_secret']) and !empty($_POST[
'gluu_client_secret']) and !$obj->registration_endpoint){
947 $gluu_config = array(
948 "gluu_oxd_port" => $_POST[
'gluu_oxd_port'],
949 "admin_email" => $this->config->get(
'config_email'),
950 "gluu_client_id" => $_POST[
'gluu_client_id'],
951 "gluu_client_secret" => $_POST[
'gluu_client_secret'],
952 "authorization_redirect_uri" => HTTPS_CATALOG.
'index.php?route=module/gluu_sso/login_by_sso',
953 "post_logout_redirect_uri" => HTTPS_CATALOG.
'index.php?route=account/logout',
954 "config_scopes" => [
"openid",
"profile",
"email"],
957 $gluu_config1 = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($gluu_config));
958 if($_POST[
'gluu_users_can_register']==2){
959 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
960 array_push($config[
'config_scopes'],
'permission');
961 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
964 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
965 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
971 $register_site->setRequestAuthorizationRedirectUri($gluu_config[
'authorization_redirect_uri']);
972 $register_site->setRequestLogoutRedirectUri($gluu_config[
'post_logout_redirect_uri']);
973 $register_site->setRequestContacts([$this->config->get(
'config_email')]);
974 $register_site->setRequestClientLogoutUri($gluu_config[
'post_logout_redirect_uri']);
975 if(!empty($obj->acr_values_supported)){
976 $get_acr = json_encode($obj->acr_values_supported);
977 $gluu_config = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_acr', $gluu_acr);
979 if(!empty($obj->scopes_supported)){
980 $get_scopes = json_encode($obj->scopes_supported);
981 $gluu_config = $this->model_module_gluu_sso->gluu_db_query_update(
'get_scopes', $get_scopes);
987 $register_site->setRequestClientSecret($_POST[
'gluu_client_secret']);
989 if(!$status[
'status']){
990 if ($status[
'message'] ==
'invalid_op_host') {
991 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
992 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
995 if (!$status[
'status']) {
996 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
997 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1000 if ($status[
'message'] ==
'internal_error') {
1001 $_SESSION[
'message_error'] =
'ERROR: '.$status[
'error_message'];
1002 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1009 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
1010 $gluu_other_config[
'gluu_oxd_id'] = $gluu_oxd_id;
1011 $gluu_other_config[
'gluu_provider'] = $gluu_provider;
1012 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
1013 $_SESSION[
'message_success'] =
'Your settings are saved successfully.';
1014 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1017 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
1018 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1023 $_SESSION[
'openid_error_edit'] =
'Error506';
1024 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1029 $gluu_config = array(
1030 "gluu_oxd_port" =>$_POST[
'gluu_oxd_port'],
1031 "admin_email" => $this->config->get(
'config_email'),
1032 "authorization_redirect_uri" => HTTPS_CATALOG.
'index.php?route=module/gluu_sso/login_by_sso',
1033 "post_logout_redirect_uri" => HTTPS_CATALOG.
'index.php?route=account/logout',
1034 "config_scopes" => [
"openid",
"profile",
"email"],
1035 "gluu_client_id" =>
"",
1036 "gluu_client_secret" =>
"",
1039 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($gluu_config)),
true);
1040 if($_POST[
'gluu_users_can_register']==2){
1041 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
1042 array_push($config[
'config_scopes'],
'permission');
1043 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
1046 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
1047 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1052 $register_site->setRequestAuthorizationRedirectUri($gluu_config[
'authorization_redirect_uri']);
1053 $register_site->setRequestLogoutRedirectUri($gluu_config[
'post_logout_redirect_uri']);
1054 $register_site->setRequestContacts([$gluu_config[
'admin_email']]);
1055 $register_site->setRequestClientLogoutUri($gluu_config[
'post_logout_redirect_uri']);
1056 $get_scopes = json_encode($obj->scopes_supported);
1057 if(!empty($obj->acr_values_supported)){
1058 $get_acr = json_encode($obj->acr_values_supported);
1059 $get_acr = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_acr', $get_acr));
1065 if(!empty($obj->scopes_supported)){
1066 $get_scopes = json_encode($obj->scopes_supported);
1067 $get_scopes = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_scopes', $get_scopes));
1074 if(!$status[
'status']){
1075 if ($status[
'message'] ==
'invalid_op_host') {
1076 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
1077 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1080 if (!$status[
'status']) {
1081 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
1082 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1085 if ($status[
'message'] ==
'internal_error') {
1086 $_SESSION[
'message_error'] =
'ERROR: '.$status[
'error_message'];
1087 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1094 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
1095 $gluu_other_config[
'gluu_oxd_id'] = $gluu_oxd_id;
1096 $gluu_other_config[
'gluu_provider'] = $gluu_provider;
1097 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
1098 $_SESSION[
'message_success'] =
'Your settings are saved successfully.';
1099 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1103 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
1104 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1110 $_SESSION[
'message_error'] =
'Please enter correct URI of the OpenID Provider';
1111 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1116 $gluu_config = array(
1117 "gluu_oxd_port" =>$_POST[
'gluu_oxd_port'],
1118 "admin_email" => $this->config->get(
'config_email'),
1119 "authorization_redirect_uri" => HTTPS_CATALOG.
'index.php?route=module/gluu_sso/login_by_sso',
1120 "post_logout_redirect_uri" => HTTPS_CATALOG.
'index.php?route=account/logout',
1121 "config_scopes" => [
"openid",
"profile",
"email"],
1122 "gluu_client_id" =>
"",
1123 "gluu_client_secret" =>
"",
1126 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($gluu_config)),
true);
1127 if($_POST[
'gluu_users_can_register']==2){
1128 $config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_config'),
true);
1129 array_push($config[
'config_scopes'],
'permission');
1130 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', json_encode($config)),
true);
1133 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
1134 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1138 $register_site->setRequestAuthorizationRedirectUri($gluu_config[
'authorization_redirect_uri']);
1139 $register_site->setRequestLogoutRedirectUri($gluu_config[
'post_logout_redirect_uri']);
1140 $register_site->setRequestContacts([$gluu_config[
'admin_email']]);
1143 $register_site->setRequestClientLogoutUri($gluu_config[
'post_logout_redirect_uri']);
1146 if(!$status[
'status']){
1147 if ($status[
'message'] ==
'invalid_op_host') {
1148 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
1149 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1152 if (!$status[
'status']) {
1153 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
1154 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1157 if ($status[
'message'] ==
'internal_error') {
1158 $_SESSION[
'message_error'] =
'ERROR: '.$status[
'error_message'];
1159 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1166 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
1167 $gluu_other_config[
'gluu_oxd_id'] = $gluu_oxd_id;
1168 $gluu_other_config[
'gluu_provider'] = $gluu_provider;
1169 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
1170 $arrContextOptions=array(
1172 "verify_peer"=>
false,
1173 "verify_peer_name"=>
false,
1176 $json = file_get_contents($gluu_provider.
'/.well-known/openid-configuration',
false, stream_context_create($arrContextOptions));
1177 $obj = json_decode($json);
1179 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
1180 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1185 $register_site->setRequestAuthorizationRedirectUri($gluu_config[
'authorization_redirect_uri']);
1186 $register_site->setRequestLogoutRedirectUri($gluu_config[
'post_logout_redirect_uri']);
1187 $register_site->setRequestContacts([$gluu_config[
'admin_email']]);
1188 $register_site->setRequestClientLogoutUri($gluu_config[
'post_logout_redirect_uri']);
1190 $get_scopes = json_encode($obj->scopes_supported);
1191 if(!empty($obj->acr_values_supported)){
1192 $get_acr = json_encode($obj->acr_values_supported);
1193 $get_acr = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_acr', $get_acr);
1199 if(!empty($obj->scopes_supported)){
1200 $get_scopes = json_encode($obj->scopes_supported);
1201 $get_scopes = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_scopes', $get_scopes);
1208 if(!$status[
'status']){
1209 if ($status[
'message'] ==
'invalid_op_host') {
1210 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
1211 $this->response->redirect($this->url->link(
'module/gluu_sso/edit',
'token=' . $this->session->data[
'token'],
'SSL'));
1214 if (!$status[
'status']) {
1215 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
1216 $this->response->redirect($this->url->link(
'module/gluu_sso/edit',
'token=' . $this->session->data[
'token'],
'SSL'));
1219 if ($status[
'message'] ==
'internal_error') {
1220 $_SESSION[
'message_error'] =
'ERROR: '.$status[
'error_message'];
1221 $this->response->redirect($this->url->link(
'module/gluu_sso/edit',
'token=' . $this->session->data[
'token'],
'SSL'));
1228 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_other_config'),
true);
1229 $gluu_other_config[
'gluu_oxd_id'] = $gluu_oxd_id;
1230 $gluu_other_config[
'gluu_provider'] = $gluu_provider;
1231 $gluu_other_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_other_config', json_encode($gluu_other_config)),
true);
1232 $_SESSION[
'message_success'] =
'Your settings are saved successfully.';
1233 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1237 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
1238 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1243 $_SESSION[
'message_error'] =
'ERROR: OpenID Provider host is required if you don\'t provide it in oxd-default-site-config.json';
1244 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1249 else if( isset( $_REQUEST[
'form_key'] ) and strpos( $_REQUEST[
'form_key'],
'general_oxd_id_reset' ) !==
false and !empty($_REQUEST[
'resetButton'])) {
1250 $this->model_module_gluu_sso->drop_table();
1251 unset($_SESSION[
'openid_error']);
1252 unset($_SESSION[
'openid_error_edit']);
1253 $_SESSION[
'openid_error'] =
'';
1254 $_SESSION[
'openid_error_edit'] =
'';
1255 $_SESSION[
'message_success'] =
'Configurations deleted Successfully.';
1256 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1258 else if( isset( $_REQUEST[
'form_key'] ) and strpos( $_REQUEST[
'form_key'],
'openid_config_page' ) !== false ) {
1259 $params = $_REQUEST;
1260 $message_success =
'';
1261 $message_error =
'';
1263 if($_POST[
'send_user_type']){
1264 $gluu_auth_type = $_POST[
'send_user_type'];
1265 $gluu_auth_type = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_auth_type', $gluu_auth_type);
1267 $gluu_auth_type = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_auth_type',
'default');
1269 if($_POST[
'send_user_check']){
1270 $gluu_send_user_check = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_send_user_check',
'yes');
1272 $gluu_send_user_check = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_send_user_check',
'no');
1276 if(!empty($params[
'scope']) && isset($params[
'scope'])){
1277 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
"gluu_config"),
true);
1278 $gluu_config[
'config_scopes'] = $params[
'scope'];
1279 $gluu_config = json_encode($gluu_config);
1280 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_config', $gluu_config),
true);
1282 if(!empty($params[
'scope_name']) && isset($params[
'scope_name'])){
1283 $get_scopes = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
"gluu_scopes"),
true);
1284 foreach($params[
'scope_name'] as $scope){
1285 if($scope && !in_array($scope,$get_scopes)){
1286 array_push($get_scopes, $scope);
1289 $get_scopes = json_encode($get_scopes);
1290 $get_scopes = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_scopes', $get_scopes),
true);
1292 $gluu_acr = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
'gluu_acr'),
true);
1294 if(!empty($params[
'acr_name']) && isset($params[
'acr_name'])){
1295 $get_acr = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
"gluu_acr"),
true);
1296 foreach($params[
'acr_name'] as $scope){
1297 if($scope && !in_array($scope,$get_acr)){
1298 array_push($get_acr, $scope);
1301 $get_acr = json_encode($get_acr);
1302 $get_acr = json_decode($this->model_module_gluu_sso->gluu_db_query_update(
'gluu_acr', $get_acr),
true);
1304 $gluu_config = json_decode($this->model_module_gluu_sso->gluu_db_query_select(
"gluu_config"),
true);
1305 $gluu_oxd_id = $this->model_module_gluu_sso->gluu_db_query_select(
"gluu_oxd_id");
1307 $_SESSION[
'message_error'] =
'Can not connect to the oxd server. Please check the oxd-config.json file to make sure you have entered the correct port and the oxd server is operational.';
1308 $this->response->redirect($this->url->link(
'module/gluu_sso',
'token=' . $this->session->data[
'token'],
'SSL'));
1322 $get_scopes = $this->model_module_gluu_sso->gluu_db_query_update(
'gluu_oxd_id', $new_oxd_id);
1326 $_SESSION[
'message_success'] =
'Your OpenID connect configuration has been saved.';
1327 $_SESSION[
'message_error'] = $message_error;
1328 $this->response->redirect($this->url->link(
'module/gluu_sso/openidconfig',
'token=' . $this->session->data[
'token'],
'SSL'));
$update_site_registration
Definition: Update_site_registration_test.php:7
$register_site
Definition: Register_site_test.php:7
Definition: Update_site_registration.php:62
gluu_is_port_working()
Definition: gluu_sso.php:1341
Definition: Register_site.php:62
$_SESSION['id_token']
Definition: Get_tokens_by_code_test.php:15