Skip to content

Commit 3b81ea8

Browse files
Irfan SharifIrfan Sharif
authored andcommitted
replace poor name of gsstoken with kerbticket
Signed-off-by: Irfan Sharif <IrfanSharif@ibm.com>
1 parent f54510e commit 3b81ea8

File tree

5 files changed

+41
-42
lines changed

5 files changed

+41
-42
lines changed

src/main/java/com/ibm/as400/access/AS400.java

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -389,28 +389,27 @@ public class AS400 implements Serializable, AutoCloseable
389389
private boolean forcePrompt_ = false;
390390
private int validateSignonTimeOut_ = 0;
391391

392-
// GSS Token, for Kerberos.
393-
private byte[] gssToken_;
392+
private byte[] kerbTicket_;
394393

395394
// Prefix used to indicate that the password contains a base64-encoded Kerberos token.
396395
public static final String KERBEROS_PREFIX = "_KERBEROSAUTH_";
397396
public static final char[] KERBEROS_PREFIX_CHARS = KERBEROS_PREFIX.toCharArray();
398397

399-
private void setGSSToken(byte[] token) {
400-
this.gssToken_ = token.clone();
398+
private void setKerbTicket(byte[] ticket) {
399+
this.kerbTicket_ = ticket.clone();
401400
}
402401

403-
private byte[] getGSSToken() {
404-
return this.gssToken_;
402+
private byte[] getKerbTicket() {
403+
return this.kerbTicket_;
405404
}
406405

407-
public void clearGSSToken() {
408-
if (this.gssToken_ != null)
409-
CredentialVault.clearArray(gssToken_);
406+
public void clearKerbTicket() {
407+
if (this.kerbTicket_ != null)
408+
CredentialVault.clearArray(kerbTicket_);
410409
}
411410

412411
// Determines if the password contains a Kerberos token
413-
private boolean isGSSToken(char[] auth){
412+
private boolean isKerbTicket(char[] auth){
414413
char[] prefix = KERBEROS_PREFIX_CHARS;
415414
if (auth == null || auth.length < prefix.length) {
416415
return false;
@@ -425,7 +424,7 @@ private boolean isGSSToken(char[] auth){
425424
}
426425

427426
// Extracts the Kerberos token from the password
428-
private static char[] getGSSTokenFromPassword(char[] password) {
427+
private static char[] getKerbTicketFromPassword(char[] password) {
429428
int prefixLen = KERBEROS_PREFIX_CHARS.length;
430429
int tokenLen = password.length - prefixLen;
431430

@@ -706,12 +705,12 @@ public AS400(String systemName, String userId, char[] password)
706705

707706
userId_ = userId.toUpperCase();
708707
// Create appropriate credential vault based on whether the password is a Kerberos token or a regular password.
709-
boolean kerbToken = isGSSToken(password);
710-
if (kerbToken){
711-
password = getGSSTokenFromPassword(password);
708+
boolean isKerberosTicket = isKerbTicket(password);
709+
if (isKerberosTicket){
710+
password = getKerbTicketFromPassword(password);
712711
credVault_ = new GSSTokenVault();
713712

714-
this.setGSSToken(Base64.getDecoder().decode((new String(password))));
713+
this.setKerbTicket(Base64.getDecoder().decode((new String(password))));
715714
}else{
716715
checkPasswordNullAndLength(password, "password");
717716
credVault_ = new PasswordVault(password);
@@ -1851,9 +1850,9 @@ private synchronized void chooseImpl()
18511850
}
18521851
}
18531852

1854-
// If gssToken_ has been set, make sure the impl knows about it.
1855-
if (gssToken_ != null)
1856-
impl_.setGSSToken(gssToken_);
1853+
// If kerbTicket_ has been set, make sure the impl knows about it.
1854+
if (kerbTicket_ != null)
1855+
impl_.setKerbTicket(kerbTicket_);
18571856

18581857
if (!propertiesFrozen_)
18591858
{
@@ -4206,7 +4205,7 @@ public void removeVetoableChangeListener(VetoableChangeListener listener)
42064205
public synchronized void resetAllServices()
42074206
{
42084207
if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Resetting all services.");
4209-
clearGSSToken();
4208+
clearKerbTicket();
42104209
setStayAlive(0);
42114210

42124211
disconnectAllServices();
@@ -5507,9 +5506,9 @@ synchronized void signon(boolean keepConnection) throws AS400SecurityException,
55075506
// Try for Kerberos.
55085507
byte[] newBytes = null;
55095508

5510-
if (gssToken_ != null && gssToken_.length > 0) {
5511-
if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Using injected GSS token.");
5512-
newBytes = gssToken_.clone();
5509+
if (kerbTicket_ != null && kerbTicket_.length > 0) {
5510+
if (Trace.traceOn_) Trace.log(Trace.DIAGNOSTIC, "Using injected Kerberos ticket.");
5511+
newBytes = kerbTicket_.clone();
55135512
} else {
55145513
// Fall back to generating the token normally
55155514
newBytes = (gssCredential_ == null)

src/main/java/com/ibm/as400/access/AS400Impl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,5 @@ interface AS400Impl
9696
void setVRM(int v, int r, int m);
9797

9898

99-
void setGSSToken(byte[] token);
99+
void setKerbTicket(byte[] ticket);
100100
}

src/main/java/com/ibm/as400/access/AS400ImplProxy.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public SignonInfo skipSignon(String systemName, boolean systemNameLocal, String
371371

372372

373373
private int bidiStringType = BidiStringType.DEFAULT;
374-
private byte[] gssToken_;
374+
private byte[] kerbTicket_;
375375

376376
/**
377377
* Sets bidi string type of the connection.
@@ -407,12 +407,12 @@ public void setAdditionalAuthenticationFactor(char[] additionalAuthFactor) {
407407
}
408408

409409
@Override
410-
public void setGSSToken(byte[] token) {
411-
this.gssToken_ = token;
410+
public void setKerbTicket(byte[] ticket) {
411+
this.kerbTicket_ = ticket;
412412
}
413413

414-
private byte[] getGSSToken() {
415-
return this.gssToken_;
414+
private byte[] getKerbTicket() {
415+
return this.kerbTicket_;
416416
}
417417

418418
}

src/main/java/com/ibm/as400/access/AS400ImplRemote.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public class AS400ImplRemote implements AS400Impl
189189
private static final String CLASSNAME = "com.ibm.as400.access.AS400ImplRemote";
190190

191191
// GSS Token, for Kerberos.
192-
private byte[] gssToken_;
192+
private byte[] kerbTicket_;
193193

194194
static {
195195
if (Trace.traceOn_)
@@ -669,8 +669,8 @@ public int createUserHandle() throws AS400SecurityException, IOException
669669
try
670670
{
671671
byte[] authenticationBytes;
672-
if (this.gssToken_ != null){
673-
authenticationBytes = this.gssToken_;
672+
if (this.kerbTicket_ != null){
673+
authenticationBytes = this.kerbTicket_;
674674
} else {
675675
authenticationBytes = (gssCredential_ == null)
676676
? TokenManager.getGSSToken(systemName_, gssName_)
@@ -1023,8 +1023,8 @@ public void generateProfileToken(ProfileTokenCredential profileToken, String use
10231023
case AS400.AUTHENTICATION_SCHEME_GSS_TOKEN:
10241024
try
10251025
{
1026-
if (this.gssToken_ != null){
1027-
authenticationBytes = this.gssToken_;
1026+
if (this.kerbTicket_ != null){
1027+
authenticationBytes = this.kerbTicket_;
10281028
} else {
10291029
authenticationBytes = (gssCredential_ == null)
10301030
? TokenManager.getGSSToken(systemName_, gssName)
@@ -1849,8 +1849,8 @@ byte[] getPassword(byte[] clientSeed, byte[] serverSeed) throws AS400SecurityExc
18491849
if (credType == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN)
18501850
{
18511851
try {
1852-
if (gssToken_ != null)
1853-
return gssToken_;
1852+
if (kerbTicket_ != null)
1853+
return kerbTicket_;
18541854
return (gssCredential_ == null)
18551855
? TokenManager.getGSSToken(systemName_, gssName_)
18561856
: TokenManager2.getGSSToken(systemName_, gssCredential_);
@@ -2229,8 +2229,8 @@ private byte[] getDdmEncryptedPassword(byte[] sharedPrivateKey, byte[] serverSee
22292229
if (credType == AS400.AUTHENTICATION_SCHEME_GSS_TOKEN)
22302230
{
22312231
try {
2232-
if (gssToken_ != null)
2233-
return gssToken_;
2232+
if (kerbTicket_ != null)
2233+
return kerbTicket_;
22342234
return (gssCredential_ == null)
22352235
? TokenManager.getGSSToken(systemName_, gssName_)
22362236
: TokenManager2.getGSSToken(systemName_, gssCredential_);
@@ -5419,12 +5419,12 @@ public String getLocalIPAddress() {
54195419
}
54205420

54215421
@Override
5422-
public void setGSSToken(byte[] token) {
5423-
this.gssToken_ = token;
5422+
public void setKerbTicket(byte[] ticket) {
5423+
this.kerbTicket_ = ticket;
54245424
}
54255425

5426-
private byte[] getGSSToken() {
5427-
return this.gssToken_;
5426+
private byte[] getKerbTicket() {
5427+
return this.kerbTicket_;
54285428
}
54295429

54305430
}

src/main/java/com/ibm/as400/access/AS400JDBCConnectionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ public void close ()
594594
as400_.disconnectServer (server_);
595595
// Clear the sensitive auth token via the public AS400 object
596596
if (as400PublicClassObj_ != null) {
597-
as400PublicClassObj_.clearGSSToken();
597+
as400PublicClassObj_.clearKerbTicket();
598598
}
599599

600600
server_ = null;

0 commit comments

Comments
 (0)