rubycas-server 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,55 @@
1
+ %w[active_support markaby tempfile uri].map{|l|require l}
2
+ module Camping;Apps=[];C=self;S=IO.read(__FILE__).sub(/S=I.+$/,'')
3
+ P="Cam\ping Problem!";module Helpers;def R(c,*g);p,h=/\(.+?\)/,g.grep(Hash)
4
+ (g-=h).inject(c.urls.find{|x|x.scan(p).size==g.size}.dup){|s,a|s.sub p,C.
5
+ escape((a[a.class.primary_key]rescue a))}+(h.any?? "?"+h[0].map{|x|x.map{|z|C.
6
+ escape z}*"="}*"&": "")end;def URL c='/',*a;c=R(c,*a)if c.
7
+ respond_to?:urls;c=self/c;c="//"+@env.HTTP_HOST+c if c[/^\//];URI(c)end;def/p
8
+ p[/^\//]?@root+p : p end;def errors_for o;ul.errors{o.errors.each_full{|x|li x}
9
+ }if o.errors.any?end end;module Base;include Helpers;attr_accessor:input,
10
+ :cookies,:env,:headers,:body,:status,:root;def method_missing*a,&b
11
+ a.shift if a[0]==:render;m=Mab.new({},self);s=m.capture{send(*a,&b)}
12
+ s=m.capture{send(:layout){s}} if /^_/!~a[0].to_s and m.respond_to?:layout
13
+ s end;def r s,b,h={};@status=s;@headers.merge!h;@body=b end
14
+ def redirect*a;r 302,'','Location'=>URL(*a)end;Z="\r\n"
15
+ def to_a;[@status,@body,@headers]end
16
+ def initialize r,e,m;e=H[e.to_hash];@status,@method,@env,@headers,@root=200,m.
17
+ downcase,e,{'Content-Type'=>"text/html"},e.SCRIPT_NAME.sub(/\/$/,'')
18
+ @k=C.kp e.HTTP_COOKIE;q=C.qsp e.QUERY_STRING;@in=r
19
+ if%r|\Amultipart/form-.*boundary=\"?([^\";,]+)|n.match e.CONTENT_TYPE
20
+ b=/(?:\r?\n|\A)#{Regexp::quote("--#$1")}(?:--)?\r$/;until@in.eof?;fh=H[];for l in@in
21
+ case l;when Z;break;when/^Content-D.+?: form-data;/;fh.u H[*$'.
22
+ scan(/(?:\s(\w+)="([^"]+)")/).flatten];when/^Content-Type: (.+?)(\r$|\Z)/m;fh[
23
+ :type]=$1;end;end;fn=fh[:name];o=if fh[:filename];o=fh[:tempfile]=Tempfile.new(:C)
24
+ o.binmode;else;fh=""end;while l=@in.read(16384);if l=~b;o<<$`.chomp;@in.seek(-$'.
25
+ size,IO::SEEK_CUR);break;end;o<<l;end;C.qsp(fn,'&;',fh,q) if fn;fh[:tempfile].rewind if
26
+ fh.is_a?H;end;elsif@method=="post";q.u C.qsp(@in.read)end;@cookies,@input=
27
+ @k.dup,q.dup end;def service*a;@body=send(@method,*a)if respond_to?@method
28
+ @headers["Set-Cookie"]=@cookies.map{|k,v|"#{k}=#{C.escape(v)}; path=#{self/'/'
29
+ }"if v!=@k[k]}-[nil];self end;def to_s;a=[];@headers.map{|k,v|[*v].map{|x|a<<
30
+ "#{k}: #{x}"}};"Status: #{@status}#{Z+a*Z+Z*2+@body}"end;end
31
+ X=module Controllers;@r=[];class<<self;def r;@r;end;def R*u;r=@r;Class.new{
32
+ meta_def(:urls){u};meta_def(:inherited){|x|r<<x}}end;def M;def M;end;constants.map{|c|
33
+ k=const_get(c);k.send:include,C,Base,Models;r[0,0]=k if !r.include?k;k.meta_def(
34
+ :urls){["/#{c.downcase}"]}if !k.respond_to?:urls}end;def D p;r.map{|k|k.urls.
35
+ map{|x|return k,$~[1..-1]if p=~/^#{x}\/?$/}};[NotFound,[p]]end end;class
36
+ NotFound<R();def get p;r(404,Mab.new{h1 P;h2 p+" not found"})end end;class
37
+ ServerError<R();def get k,m,e;r(500,Mab.new{h1 P;h2"#{k}.#{m}";h3"#{e.class
38
+ } #{e.message}:";ul{e.backtrace.each{|bt|li(bt)}}}.to_s)end end;self;end;class<<
39
+ self;def goes m;eval S.gsub(/Camping/,m.to_s).gsub("A\pps=[]","Cam\ping::Apps<<\
40
+ self"),TOPLEVEL_BINDING;end;def escape s;s.to_s.gsub(/[^ \w.-]+/n){'%'+($&.
41
+ unpack('H2'*$&.size)*'%').upcase}.tr(' ','+')end;def un s;s.tr('+',' ').gsub(
42
+ /%([\da-f]{2})/in){[$1].pack('H*')}end;def qsp q,d='&;',y=nil,z=H[];m=proc{|_,o,n|o.u(
43
+ n,&m)rescue([*o]<<n)};q.to_s.split(/[#{d}] */n).inject((b,z=z,H[])[0]){|h,p|k,v=un(p).
44
+ split('=',2);h.u k.split(/[\]\[]+/).reverse.inject(y||v){|x,i|H[i,x]},&m}end;def
45
+ kp s;c=qsp(s,';,')end;def run r=$stdin,e=ENV;X.M;k,a=X.D un("/#{e[
46
+ 'PATH_INFO']}".gsub(/\/+/,'/'));k.new(r,e,(m=e['REQUEST_METHOD']||"GET")).Y.
47
+ service *a;rescue Object=>x;X::ServerError.new(r,e,'get').service(k,m,x)end
48
+ def method_missing m,c,*a;X.M;k=X.const_get(c).new(StringIO.new,H['HTTP_HOST',
49
+ '','SCRIPT_NAME','','HTTP_COOKIE',''],m.to_s);H.new(a.pop).each{|e,f|k.send(
50
+ "#{e}=",f)}if Hash===a[-1];k.service *a;end;end;module Views;include X,Helpers
51
+ end;module Models;autoload:Base,'camping/db';def Y;self;end;end;class Mab<Markaby::Builder
52
+ include Views;def tag!*g,&b;h=g[-1];[:href,:action,:src].map{|a|(h[a]=self/h[a])rescue
53
+ 0};super end end;H=HashWithIndifferentAccess;class H;def method_missing m,*a
54
+ m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m]:raise(NoMethodError,"#{m}")end
55
+ alias_method:u,:regular_update;end end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: rubycas-server
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.2
7
- date: 2007-07-26 00:00:00 -04:00
6
+ version: 0.5.0
7
+ date: 2007-09-20 00:00:00 -04:00
8
8
  summary: Provides single sign on for web applications using the CAS protocol.
9
9
  require_paths:
10
10
  - lib
@@ -37,6 +37,7 @@ files:
37
37
  - bin/rubycas-server
38
38
  - bin/rubycas-server-ctl
39
39
  - config.example.yml
40
+ - custom_views.example.rb
40
41
  - lib/casserver.rb
41
42
  - lib/casserver/authenticators/active_directory_ldap.rb
42
43
  - lib/casserver/authenticators/base.rb
@@ -66,6 +67,13 @@ files:
66
67
  - resources/init.d.sh
67
68
  - setup.rb
68
69
  - test/test_casserver.rb
70
+ - vendor/camping-1.5.180/lib/camping-unabridged.rb
71
+ - vendor/camping-1.5.180/lib/camping.rb
72
+ - vendor/camping-1.5.180/lib/camping/db.rb
73
+ - vendor/camping-1.5.180/lib/camping/fastcgi.rb
74
+ - vendor/camping-1.5.180/lib/camping/reloader.rb
75
+ - vendor/camping-1.5.180/lib/camping/session.rb
76
+ - vendor/camping-1.5.180/lib/camping/webrick.rb
69
77
  test_files:
70
78
  - test/test_cas.rb
71
79
  - test/test_casserver.rb
@@ -81,15 +89,6 @@ extensions: []
81
89
  requirements: []
82
90
 
83
91
  dependencies:
84
- - !ruby/object:Gem::Dependency
85
- name: camping
86
- version_requirement:
87
- version_requirements: !ruby/object:Gem::Version::Requirement
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- version: "1.5"
92
- version:
93
92
  - !ruby/object:Gem::Dependency
94
93
  name: activesupport
95
94
  version_requirement: