1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.michaelo.tomcat.realm;
17
18 import java.util.Objects;
19
20 import org.ietf.jgss.GSSException;
21 import org.ietf.jgss.GSSManager;
22 import org.ietf.jgss.GSSName;
23 import org.ietf.jgss.Oid;
24
25
26
27
28
29 public class StubGSSName implements GSSName {
30
31 private final String name;
32 private final Oid oid;
33
34 public StubGSSName(String name, Oid oid) {
35 this.name = name;
36 this.oid = oid;
37 }
38
39 @Override
40 public boolean equals(GSSName another) throws GSSException {
41 if (another instanceof StubGSSName) {
42 StubGSSName stubGssName = (StubGSSName) another;
43 return Objects.equals(name, stubGssName.name) && Objects.equals(oid, stubGssName.oid);
44 }
45
46 return false;
47 }
48
49
50 @Override
51 public GSSName canonicalize(Oid mech) throws GSSException {
52 throw new UnsupportedOperationException("method canonicalize() is not supported");
53 }
54
55
56 @Override
57 public byte[] export() throws GSSException {
58 throw new UnsupportedOperationException("method export() is not supported");
59 }
60
61 @Override
62 public Oid getStringNameType() throws GSSException {
63 return oid;
64 }
65
66
67 @Override
68 public boolean isAnonymous() {
69 throw new UnsupportedOperationException("method isAnonymous() is not supported");
70 }
71
72
73 @Override
74 public boolean isMN() {
75 throw new UnsupportedOperationException("method isNM() is not supported");
76 }
77
78 @Override
79 public int hashCode() {
80 return name.hashCode();
81 }
82
83 @Override
84 public boolean equals(Object another) {
85 if (another instanceof GSSName)
86 try {
87 return equals((GSSName) another);
88 } catch (GSSException e) {
89 ;
90 }
91
92 return false;
93 }
94
95 @Override
96 public String toString() {
97 return name;
98 }
99 }