echocas-client 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +1 -0
- data/History.txt +162 -0
- data/LICENSE.txt +26 -0
- data/Manifest.txt +23 -0
- data/README.rdoc +322 -0
- data/Rakefile +63 -0
- data/init.rb +6 -0
- data/lib/casclient/client.rb +259 -0
- data/lib/casclient/frameworks/merb/strategy.rb +110 -0
- data/lib/casclient/frameworks/rails/cas_proxy_callback_controller.rb +76 -0
- data/lib/casclient/frameworks/rails/filter.rb +372 -0
- data/lib/casclient/responses.rb +191 -0
- data/lib/casclient/tickets.rb +38 -0
- data/lib/casclient/version.rb +9 -0
- data/lib/casclient.rb +89 -0
- data/lib/rubycas-client.rb +5 -0
- data/setup.rb +1585 -0
- metadata +119 -0
data/lib/casclient.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'cgi'
|
3
|
+
require 'net/https'
|
4
|
+
require 'rexml/document'
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'active_support'
|
8
|
+
rescue LoadError
|
9
|
+
require 'rubygems'
|
10
|
+
require 'active_support'
|
11
|
+
end
|
12
|
+
|
13
|
+
$: << File.expand_path(File.dirname(__FILE__))
|
14
|
+
|
15
|
+
module CASClient
|
16
|
+
class CASException < Exception
|
17
|
+
end
|
18
|
+
|
19
|
+
# Customized logger for the client.
|
20
|
+
# This is useful if you're trying to do logging in Rails, since Rails'
|
21
|
+
# clean_logger.rb pretty much completely breaks the base Logger class.
|
22
|
+
class Logger < ::Logger
|
23
|
+
def initialize(logdev, shift_age = 0, shift_size = 1048576)
|
24
|
+
@default_formatter = Formatter.new
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def format_message(severity, datetime, progrname, msg)
|
29
|
+
(@formatter || @default_formatter).call(severity, datetime, progname, msg)
|
30
|
+
end
|
31
|
+
|
32
|
+
def break
|
33
|
+
self << $/
|
34
|
+
end
|
35
|
+
|
36
|
+
class Formatter < ::Logger::Formatter
|
37
|
+
Format = "[%s#%d] %5s -- %s: %s\n"
|
38
|
+
|
39
|
+
def call(severity, time, progname, msg)
|
40
|
+
Format % [format_datetime(time), $$, severity, progname, msg2str(msg)]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Wraps a real Logger. If no real Logger is set, then this wrapper
|
46
|
+
# will quietly swallow any logging calls.
|
47
|
+
class LoggerWrapper
|
48
|
+
def initialize(real_logger=nil)
|
49
|
+
set_logger(real_logger)
|
50
|
+
end
|
51
|
+
# Assign the 'real' Logger instance that this dummy instance wraps around.
|
52
|
+
def set_real_logger(real_logger)
|
53
|
+
@real_logger = real_logger
|
54
|
+
end
|
55
|
+
# Log using the appropriate method if we have a logger
|
56
|
+
# if we dont' have a logger, gracefully ignore.
|
57
|
+
def method_missing(name, *args)
|
58
|
+
if @real_logger && @real_logger.respond_to?(name)
|
59
|
+
@real_logger.send(name, *args)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
require 'casclient/tickets'
|
66
|
+
require 'casclient/responses'
|
67
|
+
require 'casclient/client'
|
68
|
+
require 'casclient/version'
|
69
|
+
|
70
|
+
# Detect legacy configuration and show appropriate error message
|
71
|
+
module CAS
|
72
|
+
module Filter
|
73
|
+
class << self
|
74
|
+
def method_missing(method, *args)
|
75
|
+
$stderr.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
76
|
+
$stderr.puts
|
77
|
+
$stderr.puts "WARNING: Your RubyCAS-Client configuration is no longer valid!!"
|
78
|
+
$stderr.puts
|
79
|
+
$stderr.puts "For information on the new configuration format please see: "
|
80
|
+
$stderr.puts
|
81
|
+
$stderr.puts " http://rubycas-client.googlecode.com/svn/trunk/rubycas-client/README.txt"
|
82
|
+
$stderr.puts
|
83
|
+
$stderr.puts "After upgrading your configuration you should also clear your application's session store."
|
84
|
+
$stderr.puts
|
85
|
+
$stderr.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|