Class: OpenID::Server::SigningEncoder
- Defined in:
- lib/openid/server.rb
Overview
I encode responses in to WebResponses, signing them when required.
Instance Attribute Summary collapse
-
#signatory ⇒ Object
Returns the value of attribute signatory.
Instance Method Summary collapse
-
#encode(response) ⇒ Object
Encode a response to a WebResponse, signing it first if appropriate.
-
#initialize(signatory) ⇒ SigningEncoder
constructor
Create a SigningEncoder given a Signatory.
Constructor Details
#initialize(signatory) ⇒ SigningEncoder
Create a SigningEncoder given a Signatory
1161 1162 1163 |
# File 'lib/openid/server.rb', line 1161 def initialize(signatory) @signatory = signatory end |
Instance Attribute Details
#signatory ⇒ Object
Returns the value of attribute signatory.
1158 1159 1160 |
# File 'lib/openid/server.rb', line 1158 def signatory @signatory end |
Instance Method Details
#encode(response) ⇒ Object
Encode a response to a WebResponse, signing it first if appropriate.
Raises EncodingError when I can’t figure out how to encode this message.
Raises AlreadySigned when this response is already signed.
1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 |
# File 'lib/openid/server.rb', line 1172 def encode(response) # the is_a? is a bit of a kludge... it means there isn't # really an adapter to make the interfaces quite match. if !response.is_a?(Exception) and response.needs_signing() if !@signatory raise ArgumentError.new( sprintf("Must have a store to sign this request: %s", response), response) end if response.fields.has_key?(OPENID_NS, 'sig') raise AlreadySigned.new(response) end response = @signatory.sign(response) end return super(response) end |