01: /*
02: * $Id: AuthenticatorImpl.java,v 1.1 2007/08/23 12:40:56 shyam_rao Exp $
03: */
04:
05: /*
06: * The contents of this file are subject to the terms
07: * of the Common Development and Distribution License
08: * (the License). You may not use this file except in
09: * compliance with the License.
10: *
11: * You can obtain a copy of the license at
12: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
13: * See the License for the specific language governing
14: * permissions and limitations under the License.
15: *
16: * When distributing Covered Code, include this CDDL
17: * Header Notice in each file and include the License file
18: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
19: * If applicable, add the following below the CDDL Header,
20: * with the fields enclosed by brackets [] replaced by
21: * you own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
25: */
26:
27: package com.sun.xml.ws.security.trust.impl.wssx.elements;
28:
29: import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
30: import com.sun.org.apache.xml.internal.security.utils.Base64;
31: import com.sun.xml.ws.security.trust.elements.Authenticator;
32: import com.sun.xml.ws.security.trust.impl.wssx.bindings.AuthenticatorType;
33:
34: import java.util.List;
35:
36: /**
37: * Provides verification (authentication) of a computed hash.
38: *
39: * @author Manveen Kaur
40: */
41:
42: public class AuthenticatorImpl extends AuthenticatorType implements
43: Authenticator {
44:
45: public AuthenticatorImpl() {
46: // empty constructor
47: }
48:
49: public AuthenticatorImpl(AuthenticatorType aType) throws Exception {
50: //ToDo
51: }
52:
53: public AuthenticatorImpl(byte[] hash) {
54: setRawCombinedHash(hash);
55: }
56:
57: public List<Object> getAny() {
58: return super .getAny();
59: }
60:
61: public byte[] getRawCombinedHash() {
62: return getCombinedHash();
63: }
64:
65: public void setRawCombinedHash(byte[] rawCombinedHash) {
66: setCombinedHash(rawCombinedHash);
67: }
68:
69: public String getTextCombinedHash() {
70: return Base64.encode(getRawCombinedHash());
71: }
72:
73: public void setTextCombinedHash(String encodedCombinedHash) {
74: try {
75: setRawCombinedHash(Base64.decode(encodedCombinedHash));
76: } catch (Base64DecodingException de) {
77: throw new RuntimeException("Error while decoding "
78: + de.getMessage());
79: }
80: }
81:
82: }
|