mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
Cleanup unused stuff
This commit is contained in:
parent
ea0bc8a89c
commit
df094ea0e3
5 changed files with 17 additions and 115 deletions
|
@ -1,59 +0,0 @@
|
|||
SSOwat contributors
|
||||
===================
|
||||
|
||||
YunoHost is built and maintained by the YunoHost project community.
|
||||
Everyone is encouraged to submit issues and changes, and to contribute in other ways -- see https://yunohost.org/contribute to find out how.
|
||||
|
||||
--
|
||||
|
||||
SSOwat was initially built by Kload, for YunoHost v2.
|
||||
|
||||
Design was created by Théodore 'Tozz' Faure and Thomas 'Courgette' Lebeau and implemented by Courgette himself.
|
||||
|
||||
Most of code was written by Kload and opi, with help of numerous contributors.
|
||||
|
||||
Translation is made by a bunch of lovely people over the world.
|
||||
|
||||
We would like to thank anyone who ever helped the YunoHost project, and especially the SSOwat project <3
|
||||
|
||||
|
||||
SSOwat Contributors
|
||||
-------------------
|
||||
|
||||
- Kload
|
||||
- opi
|
||||
- Jérôme Lebleu
|
||||
- Maniack Crudelis
|
||||
- Julien 'ju' Malik
|
||||
- M5oul
|
||||
- Alexander Chalikiopoulos
|
||||
- Adrien 'Beudbeud' Beudin
|
||||
- Hnk Reno
|
||||
- Laurent 'Bram' Peuch
|
||||
- Loïc 'dzamlo' Damien
|
||||
- sidddy
|
||||
|
||||
|
||||
SSOwat Translators
|
||||
------------------
|
||||
|
||||
### French
|
||||
|
||||
- Jean-Baptiste Holcroft
|
||||
|
||||
### German
|
||||
|
||||
- Felix Bartels
|
||||
|
||||
### Hindi
|
||||
|
||||
- Anmol
|
||||
|
||||
### Portuguese
|
||||
|
||||
- Deleted User
|
||||
- Trollken
|
||||
|
||||
### Spanish
|
||||
|
||||
- Juanu
|
|
@ -6,11 +6,8 @@
|
|||
-- request is handled: redirected, forbidden, bypassed or served.
|
||||
--
|
||||
|
||||
-- Get the `cache` persistent shared table
|
||||
local cache = ngx.shared.cache
|
||||
|
||||
-- Import helpers
|
||||
local hlp = require "helpers"
|
||||
local hlp = require("helpers")
|
||||
|
||||
-- Initialize and get configuration
|
||||
hlp.refresh_config()
|
||||
|
@ -120,9 +117,6 @@ end
|
|||
if hlp.has_access(permission) then
|
||||
|
||||
if is_logged_in then
|
||||
-- If the user is logged in, refresh_cache
|
||||
--hlp.refresh_user_cache()
|
||||
|
||||
-- If Basic Authorization header are enable for this permission,
|
||||
-- add it to the response
|
||||
if permission["auth_header"] then
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
module('config', package.seeall)
|
||||
|
||||
local lfs = require "lfs"
|
||||
local json = require "json"
|
||||
local lfs = require("lfs")
|
||||
local json = require("json")
|
||||
|
||||
local config_attributes = nil
|
||||
local config_persistent_attributes = nil
|
||||
|
@ -28,8 +28,6 @@ function get_cookie_secret()
|
|||
return cookie_secret
|
||||
end
|
||||
|
||||
|
||||
|
||||
function compare_attributes(file_attributes1, file_attributes2)
|
||||
if file_attributes1 == nil and file_attributes2 == nil then
|
||||
return true
|
||||
|
@ -92,7 +90,6 @@ function get_config()
|
|||
portal_path = "/ssowat/",
|
||||
local_portal_domain = "yunohost.local",
|
||||
domains = { conf["portal_domain"], "yunohost.local" },
|
||||
skipped_urls = {},
|
||||
logging = "fatal", -- Only log fatal messages by default (so apriori nothing)
|
||||
permissions = {}
|
||||
}
|
||||
|
|
56
helpers.lua
56
helpers.lua
|
@ -7,12 +7,12 @@
|
|||
|
||||
module('helpers', package.seeall)
|
||||
|
||||
local cache = ngx.shared.cache
|
||||
local conf = config.get_config()
|
||||
local Logging = require("logging")
|
||||
local jwt = require("vendor.luajwtjitsi.luajwtjitsi")
|
||||
local cipher = require('openssl.cipher')
|
||||
local mime = require("mime")
|
||||
local rex = require("rex_pcre")
|
||||
|
||||
local appender = function(self, level, message)
|
||||
|
||||
|
@ -28,10 +28,6 @@ end
|
|||
local logger = Logging.new(appender)
|
||||
--logger:setLevel(logger.DEBUG) -- FIXME
|
||||
|
||||
|
||||
-- Import Perl regular expressions library
|
||||
local rex = require "rex_pcre"
|
||||
|
||||
local is_logged_in = false
|
||||
|
||||
function refresh_config()
|
||||
|
@ -42,6 +38,18 @@ function get_config()
|
|||
return conf
|
||||
end
|
||||
|
||||
function element_is_in_table(element, table)
|
||||
if table then
|
||||
for _, el in pairs(table) do
|
||||
if el == element then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- The 'match' function uses PCRE regex as default
|
||||
-- If '%.' is found in the regex, we assume it's a LUA regex (legacy code)
|
||||
-- 'match' returns the matched text.
|
||||
|
@ -53,32 +61,6 @@ function match(s, regex)
|
|||
end
|
||||
end
|
||||
|
||||
-- Read a FS stored file
|
||||
function read_file(file)
|
||||
local f = io.open(file, "rb")
|
||||
if not f then return false end
|
||||
local content = f:read("*all")
|
||||
f:close()
|
||||
return content
|
||||
end
|
||||
|
||||
|
||||
-- Lua has no sugar :D
|
||||
function is_in_table(t, v)
|
||||
for key, value in ipairs(t) do
|
||||
if value == v then return key end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Get the index of a value in a table
|
||||
function index_of(t,val)
|
||||
for k,v in ipairs(t) do
|
||||
if v == val then return k end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Test whether a string starts with another
|
||||
function string.starts(String, Start)
|
||||
if not String then
|
||||
|
@ -176,18 +158,6 @@ function has_access(permission, user)
|
|||
end
|
||||
end
|
||||
|
||||
function element_is_in_table(element, table)
|
||||
if table then
|
||||
for _, el in pairs(table) do
|
||||
if el == element then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- Set the authentication headers in order to pass credentials to the
|
||||
-- application underneath.
|
||||
function set_basic_auth_header(user)
|
||||
|
|
2
init.lua
2
init.lua
|
@ -19,7 +19,7 @@ script_path = string.sub(debug.getinfo(1).source, 2, -9)
|
|||
package.path = package.path .. ";"..script_path.."?.lua"
|
||||
|
||||
-- Load libraries
|
||||
local config = require "config"
|
||||
local config = require("config")
|
||||
|
||||
-- Load cookie secret
|
||||
cookie_secret = config.get_cookie_secret()
|
||||
|
|
Loading…
Reference in a new issue