') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); GitHub - leo108/php_cas_server: PHP CAS Server · GitHub
Skip to content

Repository files navigation

PHP CAS Server

PHP CAS Server is a PHP implementation of CAS Server Protocol based on Laravel.

中文文档

Features

  • CAS protocol v1/v2/v3 (proxy is supported now!).
  • User management, including adding/editing/searching users, enable/disable users, set/unset as administrator.
  • Service management, including adding/editing/searching services, enable/disable services.
  • I18n, support English and Chinese out of box, you can add language as your need.
  • Customize login methods, support email + password by default, you can add custom login methods by plugins. You can also disable email login by settings.

Requirements

  • PHP >= 5.5.9

Installation

By composer (Recommend)

  1. composer create-project leo108/php_cas_server php_cas_server dev-master
  2. npm install or yarn
  3. gulp

By release tarballs

Download Link

Configuration

If you install by tarball, you have to copy .env.example to .env, and then run php artisan key:generate

All settings are in .env file.

Basic

FieldDefault ValueDescription
APP_ENVlocalrunning environment,use local if in development, use production in production
APP_KEYrandom valueleft as is
APP_DEBUGtrueenable debug mode, set to false to disable
APP_LOG_LEVELdebuglog level, debug/info/notice/warning/error/critical/alert/emergency
APP_URLhttp://localhostyour app's url, needs http(s):// at the beginning
APP_LOCALEenlanguage, support en and cn out of box

Database

You have to set all fields that begin with DB_, then run php artisan migrate to initial database schema.

CAS Server

FieldDefault ValueDescription
CAS_LOCK_TIMEOUT5000CAS ticket locking time, in milliseconds
CAS_TICKET_EXPIRE300CAS ticket expire time, in seconds
CAS_TICKET_LEN32CAS ticket length, it's recommend at least 32
CAS_PROXY_GRANTING_TICKET_EXPIRE7200CAS proxy-granting ticket expire time, in seconds
CAS_PROXY_GRANTING_TICKET_LEN64CAS proxy-granting ticket length, it's recommend at least 64
CAS_PROXY_GRANTING_TICKET_IOU_LEN64CAS proxy-granting ticket IOU length, it's recommend at least 64
CAS_VERIFY_SSLtrueWhether to check ssl when calling pgt url
CAS_SERVER_ALLOW_RESET_PWDtrueallow user reset password by email
CAS_SERVER_ALLOW_REGISTERtrueallow user register
CAS_SERVER_DISABLE_PASSWORD_LOGINfalsedisable password login
CAS_SERVER_NAMECentral Authentication ServiceThe site name of your CAS Server

Setup behind reverse proxy

FieldDefault ValueDescription
TRUSTED_PROXIES127.0.0.1The IP of reserve proxy servers, separated by comma(,), you can specific IP or use s subnet such as 127.0.0.1 and 127.0.0.1/24, configurations below take effect only when visiting IP in this list
TRUSTED_HEADER_CLIENT_IPX_FORWARDED_FORUser's real IP is stored in this request header
TRUSTED_HEADER_CLIENT_HOSTX_FORWARDED_HOSTThe host user visited is stored in this request header
TRUSTED_HEADER_CLIENT_PROTOX_FORWARDED_PROTOThe http protocol user used is stored in this request header
TRUSTED_HEADER_CLIENT_PORTX_FORWARDED_PORTThe port user visited is stored in this request header

Initial database and create administrator

Execute php artisan migrate at the root directory of this project to initial database.

Execute php artisan make:admin --password=yourpassword to create an administrator account.

License

MIT.

About

PHP CAS Server

Topics

Resources

Stars

220 stars

Watchers

15 watching

Forks

Releases

Packages

Used by

Contributors

Languages