KeycloakPlugin.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /* For license terms, see /license.txt */
  3. use ChamiloSession as Session;
  4. /**
  5. * Class Keycloak.
  6. */
  7. class KeycloakPlugin extends Plugin
  8. {
  9. /**
  10. * Keycloak constructor.
  11. */
  12. protected function __construct()
  13. {
  14. parent::__construct(
  15. '1.1',
  16. 'Julio Montoya',
  17. [
  18. 'tool_enable' => 'boolean',
  19. ]
  20. );
  21. }
  22. /**
  23. * @return $this
  24. */
  25. public static function create()
  26. {
  27. static $result = null;
  28. return $result ? $result : $result = new self();
  29. }
  30. /**
  31. * @return string
  32. */
  33. public function get_block_title()
  34. {
  35. return $this->get('block_title');
  36. }
  37. /**
  38. * @return string
  39. */
  40. public function get_content()
  41. {
  42. return $this->get('content');
  43. }
  44. /**
  45. * Deletes all keycloak chamilo session data.
  46. */
  47. public function logout()
  48. {
  49. Session::erase('samlUserdata');
  50. Session::erase('samlNameId');
  51. Session::erase('samlNameIdFormat');
  52. Session::erase('samlSessionIndex');
  53. Session::erase('AuthNRequestID');
  54. }
  55. }