src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/Credentials.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 58611 53ddf218eddd
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 76
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 76
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 76
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 76
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 76
diff changeset
    22
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *  Copyright 1997 The Open Group Research Institute.  All rights reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
package sun.security.krb5.internal.ccache;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import sun.security.krb5.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import sun.security.krb5.internal.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
public class Credentials {
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    37
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    38
    PrincipalName cname;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    PrincipalName sname;
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    40
    EncryptionKey key;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    41
    KerberosTime authtime;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    42
    KerberosTime starttime;//optional
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    43
    KerberosTime endtime;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    44
    KerberosTime renewTill; //optional
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    45
    HostAddresses caddr; //optional; for proxied tickets only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    AuthorizationData authorizationData; //optional, not being actually used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    public boolean isEncInSKey;  // true if ticket is encrypted in another ticket's skey
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    48
    TicketFlags flags;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    Ticket ticket;
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    50
    Ticket secondTicket; //optional
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    51
    private boolean DEBUG = Krb5.DEBUG;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    53
    public Credentials(
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    54
            PrincipalName new_cname,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    55
            PrincipalName new_sname,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    56
            EncryptionKey new_key,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    57
            KerberosTime new_authtime,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    58
            KerberosTime new_starttime,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    59
            KerberosTime new_endtime,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    60
            KerberosTime new_renewTill,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    61
            boolean new_isEncInSKey,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    62
            TicketFlags new_flags,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    63
            HostAddresses new_caddr,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    64
            AuthorizationData new_authData,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    65
            Ticket new_ticket,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    66
            Ticket new_secondTicket) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    67
        cname = (PrincipalName) new_cname.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    68
        sname = (PrincipalName) new_sname.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    69
        key = (EncryptionKey) new_key.clone();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
16905
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
    71
        authtime = new_authtime;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
    72
        starttime = new_starttime;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
    73
        endtime = new_endtime;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
    74
        renewTill = new_renewTill;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
    75
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    76
        if (new_caddr != null) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    77
            caddr = (HostAddresses) new_caddr.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    78
        }
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    79
        if (new_authData != null) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    80
            authorizationData = (AuthorizationData) new_authData.clone();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    83
        isEncInSKey = new_isEncInSKey;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    84
        flags = (TicketFlags) new_flags.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    85
        ticket = (Ticket) (new_ticket.clone());
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    86
        if (new_secondTicket != null) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    87
            secondTicket = (Ticket) new_secondTicket.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    88
        }
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    89
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    91
    public Credentials(
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    92
            KDCRep kdcRep,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    93
            Ticket new_secondTicket,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    94
            AuthorizationData new_authorizationData,
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    95
            boolean new_isEncInSKey) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    96
        if (kdcRep.encKDCRepPart == null) //can't store while encrypted
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    97
        {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
    98
            return;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        }
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   100
        cname = (PrincipalName) kdcRep.cname.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   101
        ticket = (Ticket) kdcRep.ticket.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   102
        key = (EncryptionKey) kdcRep.encKDCRepPart.key.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   103
        flags = (TicketFlags) kdcRep.encKDCRepPart.flags.clone();
16905
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
   104
        authtime = kdcRep.encKDCRepPart.authtime;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
   105
        starttime = kdcRep.encKDCRepPart.starttime;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
   106
        endtime = kdcRep.encKDCRepPart.endtime;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
   107
        renewTill = kdcRep.encKDCRepPart.renewTill;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
   108
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   109
        sname = (PrincipalName) kdcRep.encKDCRepPart.sname.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   110
        caddr = (HostAddresses) kdcRep.encKDCRepPart.caddr.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   111
        secondTicket = (Ticket) new_secondTicket.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   112
        authorizationData =
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   113
                (AuthorizationData) new_authorizationData.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   114
        isEncInSKey = new_isEncInSKey;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   115
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   117
    public Credentials(KDCRep kdcRep) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   118
        this(kdcRep, null);
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   119
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   121
    public Credentials(KDCRep kdcRep, Ticket new_ticket) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   122
        sname = (PrincipalName) kdcRep.encKDCRepPart.sname.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   123
        cname = (PrincipalName) kdcRep.cname.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   124
        key = (EncryptionKey) kdcRep.encKDCRepPart.key.clone();
16905
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
   125
        authtime = kdcRep.encKDCRepPart.authtime;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
   126
        starttime = kdcRep.encKDCRepPart.starttime;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
   127
        endtime = kdcRep.encKDCRepPart.endtime;
0419f45c7761 8011124: Make KerberosTime immutable
weijun
parents: 13247
diff changeset
   128
        renewTill = kdcRep.encKDCRepPart.renewTill;
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   129
        // if (kdcRep.msgType == Krb5.KRB_AS_REP) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   130
        //    isEncInSKey = false;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   131
        //    secondTicket = null;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   132
        //  }
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   133
        flags = kdcRep.encKDCRepPart.flags;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   134
        if (kdcRep.encKDCRepPart.caddr != null) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   135
            caddr = (HostAddresses) kdcRep.encKDCRepPart.caddr.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   136
        } else {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   137
            caddr = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        }
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   139
        ticket = (Ticket) kdcRep.ticket.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   140
        if (new_ticket != null) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   141
            secondTicket = (Ticket) new_ticket.clone();
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   142
            isEncInSKey = true;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   143
        } else {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   144
            secondTicket = null;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   145
            isEncInSKey = false;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   146
        }
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   147
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   149
    /**
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   150
     * Checks if this credential is expired
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   151
     */
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   152
    public boolean isValid() {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   153
        boolean valid = true;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   154
        if (endtime.getTime() < System.currentTimeMillis()) {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   155
            valid = false;
76
87bd6df367b8 6590930: reed/write does not match for ccache
weijun
parents: 73
diff changeset
   156
        } else if (starttime != null) {
87bd6df367b8 6590930: reed/write does not match for ccache
weijun
parents: 73
diff changeset
   157
            if (starttime.getTime() > System.currentTimeMillis()) {
87bd6df367b8 6590930: reed/write does not match for ccache
weijun
parents: 73
diff changeset
   158
                valid = false;
87bd6df367b8 6590930: reed/write does not match for ccache
weijun
parents: 73
diff changeset
   159
            }
87bd6df367b8 6590930: reed/write does not match for ccache
weijun
parents: 73
diff changeset
   160
        } else {
87bd6df367b8 6590930: reed/write does not match for ccache
weijun
parents: 73
diff changeset
   161
            if (authtime.getTime() > System.currentTimeMillis()) {
87bd6df367b8 6590930: reed/write does not match for ccache
weijun
parents: 73
diff changeset
   162
                valid = false;
87bd6df367b8 6590930: reed/write does not match for ccache
weijun
parents: 73
diff changeset
   163
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        }
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   165
        return valid;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   166
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   168
    public PrincipalName getServicePrincipal() throws RealmException {
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   169
        return sname;
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   170
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
58611
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   172
    public Ticket getTicket() throws RealmException {
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   173
        return ticket;
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   174
    }
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   175
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   176
    public PrincipalName getServicePrincipal2() throws RealmException {
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   177
        return secondTicket == null ? null : secondTicket.sname;
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   178
    }
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   179
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   180
    public PrincipalName getClientPrincipal() throws RealmException {
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   181
        return cname;
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   182
    }
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   183
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   184
    public sun.security.krb5.Credentials setKrbCreds() {
11011
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   185
        // Note: We will not pass authorizationData to s.s.k.Credentials. The
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   186
        // field in that class will be passed to Krb5Context as the return
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   187
        // value of ExtendedGSSContext.inquireSecContext(KRB5_GET_AUTHZ_DATA),
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   188
        // which is documented as the authData in the service ticket. That
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   189
        // is on the acceptor side.
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   190
        //
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   191
        // This class is for the initiator side. Also, authdata inside a ccache
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   192
        // is most likely to be the one in Authenticator in PA-TGS-REQ encoded
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   193
        // in TGS-REQ, therefore only stored with a service ticket. Currently
d14a696e3ab5 7107019: sun.security.krb5.internal.ccache.CCacheInputStream.readCred does not use auth data
weijun
parents: 5506
diff changeset
   194
        // in Java, we only reads TGTs.
57487
643978a35f6e 8227437: S4U2proxy cannot continue because server's TGT cannot be found
mbalao
parents: 47216
diff changeset
   195
        return new sun.security.krb5.Credentials(ticket, cname, null, sname,
643978a35f6e 8227437: S4U2proxy cannot continue because server's TGT cannot be found
mbalao
parents: 47216
diff changeset
   196
                null, key, flags, authtime, starttime, endtime, renewTill,
643978a35f6e 8227437: S4U2proxy cannot continue because server's TGT cannot be found
mbalao
parents: 47216
diff changeset
   197
                caddr);
73
cf334423502b 6641312: Fix krb5 codes indentation problems
weijun
parents: 2
diff changeset
   198
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
11020
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   200
    public KerberosTime getStartTime() {
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   201
        return starttime;
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   202
    }
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   203
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    public KerberosTime getAuthTime() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        return authtime;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    public KerberosTime getEndTime() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        return endtime;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
11020
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   212
    public KerberosTime getRenewTill() {
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   213
        return renewTill;
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   214
    }
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   215
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    public TicketFlags getTicketFlags() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        return flags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    public int getEType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        return key.getEType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    }
11020
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   223
58611
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   224
    public EncryptionKey getKey() {
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   225
        return key;
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   226
    }
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   227
11020
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   228
    public int getTktEType() {
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   229
        return ticket.encPart.getEType();
a17d4ff7bae3 7111579: klist starttime, renewtill, ticket etype
weijun
parents: 11011
diff changeset
   230
    }
58611
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   231
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   232
    public int getTktEType2() {
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   233
        return (secondTicket == null) ? 0 : secondTicket.encPart.getEType();
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 57487
diff changeset
   234
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
}