KeycloakPlugin.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. }