01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package edu.iu.uis.eden.security;
17:
18: import java.security.Signature;
19:
20: import org.apache.commons.httpclient.HttpMethod;
21: import org.kuali.rice.RiceConstants;
22:
23: /**
24: * A DigitalSigner implementation which places the alias and digital signature into the request
25: * headers of the commons HttpClient's HttpMethod.
26: *
27: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
28: */
29: public class HttpClientHeaderDigitalSigner extends
30: AbstractDigitalSigner {
31:
32: private HttpMethod method;
33: private String alias;
34:
35: public HttpClientHeaderDigitalSigner(Signature signature,
36: HttpMethod method, String alias) {
37: super (signature);
38: this .method = method;
39: this .alias = alias;
40: }
41:
42: public void sign() throws Exception {
43: this.method.addRequestHeader(
44: RiceConstants.KEYSTORE_ALIAS_HEADER, this.alias);
45: this.method.addRequestHeader(
46: RiceConstants.DIGITAL_SIGNATURE_HEADER,
47: getEncodedSignature());
48: }
49:
50: }
|