Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 91 lines (79 sloc) 2.706 kb
f781966 Initial import.
matt.zukowski authored
1 require 'uri'
2 require 'cgi'
b0d1e6f Explicitly load the Logger class. (ActiveSupport 3 compatibility chan…
David Yip authored
3 require 'logger'
f781966 Initial import.
matt.zukowski authored
4 require 'net/https'
5 require 'rexml/document'
6
cf320e3 working response parsing
matt.zukowski authored
7 begin
8 require 'active_support'
9 rescue LoadError
10 require 'rubygems'
11 require 'active_support'
12 end
f781966 Initial import.
matt.zukowski authored
13
50d50d4 committing so that I can start testing this as a Rails plugin
matt.zukowski authored
14 $: << File.expand_path(File.dirname(__FILE__))
15
f781966 Initial import.
matt.zukowski authored
16 module CASClient
50d50d4 committing so that I can start testing this as a Rails plugin
matt.zukowski authored
17 class CASException < Exception
f781966 Initial import.
matt.zukowski authored
18 end
50d50d4 committing so that I can start testing this as a Rails plugin
matt.zukowski authored
19
43147ff working on Rails filter...
matt.zukowski authored
20 # Customized logger for the client.
21 # This is useful if you're trying to do logging in Rails, since Rails'
22 # clean_logger.rb pretty much completely breaks the base Logger class.
23 class Logger < ::Logger
24 def initialize(logdev, shift_age = 0, shift_size = 1048576)
25 @default_formatter = Formatter.new
26 super
27 end
28
29 def format_message(severity, datetime, progrname, msg)
30 (@formatter || @default_formatter).call(severity, datetime, progname, msg)
31 end
32
33 def break
34 self << $/
35 end
36
37 class Formatter < ::Logger::Formatter
38 Format = "[%s#%d] %5s -- %s: %s\n"
39
40 def call(severity, time, progname, msg)
41 Format % [format_datetime(time), $$, severity, progname, msg2str(msg)]
42 end
43 end
44 end
45
50d50d4 committing so that I can start testing this as a Rails plugin
matt.zukowski authored
46 # Wraps a real Logger. If no real Logger is set, then this wrapper
47 # will quietly swallow any logging calls.
43147ff working on Rails filter...
matt.zukowski authored
48 class LoggerWrapper
50d50d4 committing so that I can start testing this as a Rails plugin
matt.zukowski authored
49 def initialize(real_logger=nil)
2523261 @zuk Revert "fixed call to set_logger in LoggerWrapper#initialize -- was c…
zuk authored
50 set_logger(real_logger)
50d50d4 committing so that I can start testing this as a Rails plugin
matt.zukowski authored
51 end
52 # Assign the 'real' Logger instance that this dummy instance wraps around.
53 def set_real_logger(real_logger)
54 @real_logger = real_logger
55 end
56 # Log using the appropriate method if we have a logger
57 # if we dont' have a logger, gracefully ignore.
58 def method_missing(name, *args)
2523261 @zuk Revert "fixed call to set_logger in LoggerWrapper#initialize -- was c…
zuk authored
59 if @real_logger && @real_logger.respond_to?(name)
50d50d4 committing so that I can start testing this as a Rails plugin
matt.zukowski authored
60 @real_logger.send(name, *args)
f781966 Initial import.
matt.zukowski authored
61 end
62 end
63 end
50d50d4 committing so that I can start testing this as a Rails plugin
matt.zukowski authored
64 end
65
66 require 'casclient/tickets'
67 require 'casclient/responses'
68 require 'casclient/client'
b9c3ec5 @soupmatt make single sign out and proxy ticket storage modular and clean up th…
soupmatt authored
69 require 'casclient/tickets/storage'
492d953 detect legacy config and display warning
matt.zukowski authored
70
71 # Detect legacy configuration and show appropriate error message
72 module CAS
73 module Filter
b94f602 better formatting for error message
matt.zukowski authored
74 class << self
75 def method_missing(method, *args)
76 $stderr.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
77 $stderr.puts
78 $stderr.puts "WARNING: Your RubyCAS-Client configuration is no longer valid!!"
79 $stderr.puts
80 $stderr.puts "For information on the new configuration format please see: "
81 $stderr.puts
82 $stderr.puts " http://rubycas-client.googlecode.com/svn/trunk/rubycas-client/README.txt"
83 $stderr.puts
492d953 detect legacy config and display warning
matt.zukowski authored
84 $stderr.puts "After upgrading your configuration you should also clear your application's session store."
b94f602 better formatting for error message
matt.zukowski authored
85 $stderr.puts
86 $stderr.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
87 end
492d953 detect legacy config and display warning
matt.zukowski authored
88 end
89 end
b0d1e6f Explicitly load the Logger class. (ActiveSupport 3 compatibility chan…
David Yip authored
90 end
Something went wrong with that request. Please try again.