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
51
52
53 @Override
54 public GSSName canonicalize(Oid mech) throws GSSException {
55 throw new UnsupportedOperationException("method canonicalize() is not supported");
56 }
57
58
59
60
61
62 @Override
63 public byte[] export() throws GSSException {
64 throw new UnsupportedOperationException("method export() is not supported");
65 }
66
67 @Override
68 public Oid getStringNameType() throws GSSException {
69 return oid;
70 }
71
72
73
74
75
76 @Override
77 public boolean isAnonymous() {
78 throw new UnsupportedOperationException("method isAnonymous() is not supported");
79 }
80
81
82
83
84
85 @Override
86 public boolean isMN() {
87 throw new UnsupportedOperationException("method isNM() is not supported");
88 }
89
90 @Override
91 public int hashCode() {
92 return name.hashCode();
93 }
94
95 @Override
96 public boolean equals(Object another) {
97 if (another instanceof GSSName)
98 try {
99 return equals((GSSName) another);
100 } catch (GSSException e) {
101 ;
102 }
103
104 return false;
105 }
106
107 @Override
108 public String toString() {
109 return name;
110 }
111
112 }