Git Product home page Git Product logo

php_cas_server's Introduction

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

Field Default Value Description
APP_ENV local running environment,use local if in development, use production in production
APP_KEY random value left as is
APP_DEBUG true enable debug mode, set to false to disable
APP_LOG_LEVEL debug log level, debug/info/notice/warning/error/critical/alert/emergency
APP_URL http://localhost your app's url, needs http(s):// at the beginning
APP_LOCALE en language, 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

Field Default Value Description
CAS_LOCK_TIMEOUT 5000 CAS ticket locking time, in milliseconds
CAS_TICKET_EXPIRE 300 CAS ticket expire time, in seconds
CAS_TICKET_LEN 32 CAS ticket length, it's recommend at least 32
CAS_PROXY_GRANTING_TICKET_EXPIRE 7200 CAS proxy-granting ticket expire time, in seconds
CAS_PROXY_GRANTING_TICKET_LEN 64 CAS proxy-granting ticket length, it's recommend at least 64
CAS_PROXY_GRANTING_TICKET_IOU_LEN 64 CAS proxy-granting ticket IOU length, it's recommend at least 64
CAS_VERIFY_SSL true Whether to check ssl when calling pgt url
CAS_SERVER_ALLOW_RESET_PWD true allow user reset password by email
CAS_SERVER_ALLOW_REGISTER true allow user register
CAS_SERVER_DISABLE_PASSWORD_LOGIN false disable password login
CAS_SERVER_NAME Central Authentication Service The site name of your CAS Server

Setup behind reverse proxy

Field Default Value Description
TRUSTED_PROXIES 127.0.0.1 The 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_IP X_FORWARDED_FOR User's real IP is stored in this request header
TRUSTED_HEADER_CLIENT_HOST X_FORWARDED_HOST The host user visited is stored in this request header
TRUSTED_HEADER_CLIENT_PROTO X_FORWARDED_PROTO The http protocol user used is stored in this request header
TRUSTED_HEADER_CLIENT_PORT X_FORWARDED_PORT The 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.

php_cas_server's People

Contributors

leo108 avatar phy25 avatar satouriko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php_cas_server's Issues

LDAP Support Available?

Good afternoon!

I just came across your project and am probably going to try experimenting with it when I have a chance but I wanted to ask if it already has support for the authentication to occur against an LDAP server or can it only authenticate against its internal database?

Thank you!

如何单点退出

A客户端退出,B客户端还保存登录状态,代码如下
1.退出代码
PHPCAS::setDebug(storage_path('logout.log'));
PHPCAS::setVerbose(true);
// // Initialize phpCAS
phpCAS::client(CAS_VERSION_3_0, config('cas.cas_host'), config('cas.cas_port'), config('cas.cas_context'));
phpCAS::setNoCasServerValidation();
phpCAS::logout();
2.获得登录信息代码
PHPCAS::setDebug(storage_path('casb.log'));
PHPCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_3_0, config('cas2.cas_host'), config('cas2.cas_port'), config('cas2.cas_context'));
phpCAS::handleLogoutRequests();
phpCAS::setNoCasServerValidation();

    phpCAS::forceAuthentication();

LOG

Where is log cas server ?

Support for cas-attribute

I'm using this server with apache mod_auth_cas and it's working great. I wonder if it is possible to add custom CAS attributes to the users fields :

<Location /secured>
	Authtype CAS
	Require cas-attribute edupersonaffiliation:staff
</Location>
<Location /admin>
	Authtype CAS
	Require cas-attribute edupersonaffiliation:admin
</Location>

I would greatly appreciate if you could give a brief instruction on this.

Setting User

Hello,

Have you implemented user can login by some service only ?
eg :
enable login for : service1.com, service2.com
but disable login for : service3.com

服务端session过期,客户端不能正常登出

leo你好

当服务端sessio过期时,此时用户停留在客户端登录后的页面。
这时当用户点击退出按钮时,报错

session_destroy(): Session object destruction failed

我的代码

 $this->initCAS();
  phpCAS::logoutWithRedirectService(route('welcome'));

当我试图用捕获错误的方法不终止代码运行,重定向到欢迎页

try{
                    $this->initCAS();
                    phpCAS::logoutWithRedirectService(route('welcome'));
                    info('cas成功登出');
                    return;
                }catch(\Exception $e){
                    info('cas error');
                    info($e->getMessage());
                }
                return redirect()->route('welcome');

此时页面返回
image

是否有个接口去判断服务端的session已经过期?之后在进行其他操作

想增加对手机号登录的支持,请指点。

能否会有后续升级的可能或者增加新的plugin支持手机号的登录,最好能有手机短信验证之类的可以一起考虑进去,如若暂无升级计划,请指点如何增加对手机号登录的支持,谢谢!

编译环境标识不清楚

编译环境标识不清楚,glup ,node,等版本问题导致很多异常。建议变你当前生产环境住一个标注

Error in helpers.php when installing on Windows ampps

I'm trying to install php_cas_server on ampps on Windows 10, but http://my-local-domain/cas/login gives the following error:

ErrorException in helpers.php line 343:
file_get_contents(D:\www\phpcasserver\public\build/rev-manifest.json): failed to open stream: No such file or directory (View: D:\www\phpcasserver\resources\views\layouts\app.blade.php)

I've installed Python 2.7 and I've run the following commands to install other components:

npm install --no-bin-links
npm audit fix
npm install -g --production windows-build-tools
npm install gulp --global
npm install node-sass@latest
npm install laravel-elixir --save-dev

npm install --no-bin-links outputs npm WARN [email protected] requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.

Also tried npm i -g gulp-cli but I'm still stuck with the missing rev-manifest.json error. Any ideas please?

Admin Area Logging Out Issue

I was in the admin area and switching between the Dashboard to the Users area then to the Services area then back to the Dashboard and as I'm clicking on those different areas the app seems to be logging me out.

I'm not sure if you can replicate the same problem on your end but that was something I just noticed right now.

gulp error

图片
作者您好,有没有完整的一套示例,搭建php cas server之后用cas client 连接的教程呢?

Question about service login

What is the user flow? Is it: the user registers their account email and password on this CAS server, then a web service built with a CAS Client (like phpCAS) can authenticate with this CAS server when the user enters their email & password in the remote web service login page? Is my understanding correct?

URL for service

Hi! Tanks for sharing the project.
What is an example of URL for redirect to the cas Server?
I try service-auth but there is no route to that.
Thanks!
PD: Sorry for me english

Getting attributes

Hello! I'm trying to configure cas auth for my projects and I stoped on your app. I like it very much, very cool and simple for configure. Please, tell me how can I get all the user attributes (such as email, name etc.) from cas server?

Error on running gulp

Hi,
I'm trying to follow the installation steps, but I have this error when running gulp:

[SyntaxError: Unexpected token ...]

There is any known clue for this?

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.