# humble_openid_server **Repository Path**: douchunrong/humble_openid_server ## Basic Information - **Project Name**: humble_openid_server - **Description**: ruby on rails OpenID Provider - **Primary Language**: Ruby - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2015-07-16 - **Last Updated**: 2022-05-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Openid (server) 提供者 - 这是一个完整的 Openid server ,支持2.0协议。 - 并且有完整的 ACL 控制权限系统。 - 依赖 ruby-openid-2.17.0 - 数据库: mysql5.6 ## 运行 首先获取项目: ``` git clone https://gitee.com/traynor/humble_openid_server.git ``` 然后顺序执行: 到项目根目录 `cd humble_openid_server` ``` bundle install rake db:create rake db:migrate rake db:seed ``` 启动: _rails s_ ## 接口 ``` 接口 注册:http://xxxxxx/api/auth/signup 类型: Post 参数: { login: xxx password: xxx } 返回格式: - header: { status: 200 ACTIVATIONCODE: xxx } CURL测试: curl -i -X POST -H "Content-Type: application/json" http://localhost:3000/api/auth/signup -d '{"login": "mrhades@163.com","password":"111111"}' 登录: http://xxxxxx/api/auth/signin 类型:Post 参数: { login: xxx password: xxx } 返回格式: - header: { status: 200 AUTHTOKEN:xxxxx USERID: xxxxx } CURL测试: curl -i -X POST -H "Content-Type: application/json" http://open.humbleadmin.io:端口/api/auth/signin -d '{"login": "邮箱或者手机号码","password":"111111"}' 用户激活: http://xxxxxx/api/auth/active_user 类型: Post 参数: { login: xxx active_code: xxx } 返回格式: - header: status: 200 CURL测试: curl -i -X POST -H "Content-Type: application/json" http://open.humbleadmin.io:端口/api/auth/active_user -d '{"login": "邮箱或者手机号码", "active_code":"xasddgYncasaKBH7123BJYdsx"}' 忘记密码: http://xxxxxx/api/auth/forget_passwd 类型:Post 参数: { login: xxx DeviceModel: xxx } 返回: - header: { status: 200 RESETCODE: xxx } CURL测试: curl -i -X POST -H "Content-Type: application/json" http://open.humbleadmin.io:端口/api/auth/forget_passwd -d '{"login":"邮箱或者手机号码","DeviceModel": "xxxxx"}' 重置密码: http://xxxxxx/api/auth/reset_passwd 类型: Put 参数: { login: xxx reset_token:xxx npwd: xxx } 返回: - header: status: 200 CURL测试: curl -i -X PUT -H "Content-Type: application/json" http://open.humbleadmin.io:端口/api/auth/reset_passwd -d '{"login":"邮箱或者手机号码","reset_token": "xxxxx","npwd":"xxxxx"}' 查询 : http://xxxxxx/api/auth/find_user/:login 类型: Get 备注: login 是指用户名 返回: - header: status: 200 CURL测试: curl -i -X GET -H "Content-Type: application/json" http://open.humbleadmin.io:端口/api/auth/find_user?login="xxxxx" 查询用户信息: http://xxxxxx/api/v1/user_info/:ID 类型:Get 备注:ID 指用户 id 返回: { :user_id => xxx, :title => xxx, :nickname => xxx, :email => xxx, :fullname => xxx, :postcode => xxx, :country => xxx, :language => xxx, :timezone => xxx, :gender => xxx, :address => xxx, :address_additional => xxx, :city => xxx, :state => xxx, :company_name => xxx, :job_title => xxx, :address_business => xxx, :address_additional_business => xxx, :postcode_business => xxx, :city_business => xxx, :state_business => xxx, :country_business => xxx, :phone_home => xxx, :phone_mobile => xxx, :phone_work => xxx, :phone_fax => xxx, :im_qq => xxx, :im_wx => xxx, :im_sina => xxx, :im_taobao => xxx, :im_msn => xxx, :im_yahoo => xxx, :im_baidu => xxx, :im_skype => xxx, :image_default => xxx, :web_default => xxx, :web_blog => xxx, :dob_day => xxx, :dob_month => xxx, :dob_year => xxx, :deletable => xxx } CURL测试: curl -i -X POST -H "Content-Type: application/json" -H "SINGLE_ACCESS_TOKEN:登录后获取的 authtoen" http://open.humbleadmin.io:端口/api/v1/user_info/1 修改用户信息:http://xxxxxx/api/v1/user_info 类型:Put 参数: - header: HTTP_SINGLE_ACCESS_TOKEN: xxxx { user_id: xxx user_info: {xxxx} } CURL测试: curl -i -X PUT -H "Content-Type: application/json" -H "SINGLE_ACCESS_TOKEN:登录后获取的 authtoen" http://open.humbleadmin.io:端口/api/v1/user_info -d {"nickname":"aaaa","fullname":"bbbbb"} ``` ## HTTP 返回码 ``` 100 => '请求者应当继续提出请求', 101 => '请求者已要求服务器切换协议,服务器已确认并准备切换', 102 => '请求处理中', 200 => '请求成功', 201 => '请求成功并且服务器创建了新的资源', 202 => '服务器已接受请求,但尚未处理', 203 => '服务器已成功处理了请求,但返回的信息可能来自另一来源', 204 => '服务器成功处理了请求,但没有返回任何内容', 205 => '服务器成功处理了请求,但没有返回任何内容,请重置表单', 206 => '服务器成功处理了部分 GET 请求', 207 => '多状态请求', 208 => '请求报告已发送', 300 => '多种选择请求', 301 => '请求的网页已永久移动到新位置', 302 => '临时移动', 303 => '查看其他位置', 304 => '未修改', 305 => '使用代理', 307 => '临时重定向', 308 => '永久重定向', 400 => '请求无效', 401 => '请求未经授权', 402 => '请求前需付款', 403 => '服务器收到请求,但是拒绝提供服务', 404 => '服务器找不到请求的网页', 405 => '禁用请求中指定的方法', 406 => '无法使用请求的内容特性响应请求的网页', 407 => '需要代理授权', 408 => '请求超时', 409 => '服务器在完成请求时发生冲突', 410 => '请求的资源已永久删除', 411 => '请求长度无效', 412 => '未满足前提条件', 413 => '请求实体过大', 414 => '请求的 URI 过长', 415 => '不支持的媒体类型', 416 => '请求范围不符合要求', 417 => '未满足期望值', 421 => '请求数量超出限定范围', 422 => '请求无效', 423 => '当前资源被锁定', 424 => '由于之前的某个请求发生的错误,导致当前请求失败', 426 => '请求前需升级', 429 => '请求数量过多', 431 => '请求头过大,请求失败', 432 => "用户不存在", 433 => "密码错误", 434 => "用户注册后未激活", 435 => "用户已存在,不可重复注册", 436 => "令牌过期", 437 => "已经激活", 438 => "动态激活码错误", 439 => "所传参数不必配", 440 => "密码过短", 500 => '服务器发生不可预期的错误', 501 => '方法未实现', 502 => '网关错误', 503 => '服务不可用', 504 => '网关请求超时', 505 => 'HTTP版本不支持', 506 => '服务器存在内部配置错误', 507 => '服务器无法存储完成请求所必须的内容', 508 => '请求内包含循环', 510 => '获取资源所需要的策略并没有没满足', 511 => '未进行身份验证' ```