sso.html 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <div class="standardContainer">
  2. <div class="ui basic segment">
  3. <h2>SSO</h2>
  4. <p>Single Sign-On (SSO) and authentication providers settings </p>
  5. </div>
  6. <div class="ui basic segment">
  7. <div class="ui yellow message">
  8. <div class="header">
  9. Experimental Feature
  10. </div>
  11. <p>Please note that this feature is still in development and may not work as expected.</p>
  12. </div>
  13. </div>
  14. <div class="ui divider"></div>
  15. <div class="ui basic segment">
  16. <h3>Authelia</h3>
  17. <p>Configuration settings for Authelia authentication provider.</p>
  18. <form class="ui form">
  19. <div class="field">
  20. <label for="autheliaServerUrl">Authelia Server URL</label>
  21. <input type="text" id="autheliaServerUrl" name="autheliaServerUrl" placeholder="Enter Authelia Server URL">
  22. <small>Example: auth.example.com</small>
  23. </div>
  24. <div class="field">
  25. <div class="ui checkbox">
  26. <input type="checkbox" id="useHttps" name="useHttps">
  27. <label for="useHttps">Use HTTPS</label>
  28. <small>Check this if your authelia server uses HTTPS</small>
  29. </div>
  30. </div>
  31. <button class="ui basic button" onclick="event.preventDefault(); updateAutheliaSettings();"><i class="green check icon"></i> Apply Change</button>
  32. </form>
  33. </div>
  34. <div class="ui divider"></div>
  35. </div>
  36. <script>
  37. $(document).ready(function() {
  38. $.cjax({
  39. url: '/api/sso/Authelia',
  40. method: 'GET',
  41. dataType: 'json',
  42. success: function(data) {
  43. $('#autheliaServerUrl').val(data.autheliaURL);
  44. $('#useHttps').prop('checked', data.useHTTPS);
  45. },
  46. error: function(jqXHR, textStatus, errorThrown) {
  47. console.error('Error fetching SSO settings:', textStatus, errorThrown);
  48. }
  49. });
  50. });
  51. function updateAutheliaSettings(){
  52. var autheliaServerUrl = $('#autheliaServerUrl').val();
  53. var useHttps = $('#useHttps').prop('checked');
  54. $.cjax({
  55. url: '/api/sso/Authelia',
  56. method: 'POST',
  57. data: {
  58. autheliaURL: autheliaServerUrl,
  59. useHTTPS: useHttps
  60. },
  61. success: function(data) {
  62. if (data.error != undefined) {
  63. $.msgbox(data.error, false);
  64. return;
  65. }
  66. msgbox('Authelia settings updated', true);
  67. console.log('Authelia settings updated:', data);
  68. },
  69. error: function(jqXHR, textStatus, errorThrown) {
  70. console.error('Error updating Authelia settings:', textStatus, errorThrown);
  71. }
  72. });
  73. }
  74. </script>