src/jdk.security.jgss/share/classes/com/sun/security/jgss/Extender.java
author bpb
Fri, 12 Jan 2018 11:06:24 -0800
changeset 48461 6a1c3a5e04f3
parent 47216 71c04702a3d5
permissions -rw-r--r--
4358774: Add null InputStream and OutputStream Reviewed-by: alanb, prappo, reinhapa, rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26629
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
     1
/*
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
     4
 *
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    10
 *
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    15
 * accompanied this code).
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    16
 *
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    20
 *
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    23
 * questions.
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    24
 */
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    25
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    26
package com.sun.security.jgss;
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    27
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    28
import org.ietf.jgss.GSSContext;
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    29
import org.ietf.jgss.GSSCredential;
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    30
import sun.security.jgss.GSSContextImpl;
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    31
import sun.security.jgss.GSSCredentialImpl;
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    32
import sun.security.jgss.JgssExtender;
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    33
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    34
// The com.sun.security.jgss extension to JGSS-API
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    35
class Extender extends JgssExtender {
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    36
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    37
    static {
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    38
        JgssExtender.setExtender(new Extender());
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    39
    }
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    40
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    41
    public GSSCredential wrap(GSSCredential cred) {
41372
893bf8209c04 8167181: Exported elements referring to inaccessible types in jdk.security.jgss
weijun
parents: 26630
diff changeset
    42
        if (cred instanceof ExtendedGSSCredentialImpl) {
26629
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    43
            return cred;
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    44
        } else {
41372
893bf8209c04 8167181: Exported elements referring to inaccessible types in jdk.security.jgss
weijun
parents: 26630
diff changeset
    45
            return new ExtendedGSSCredentialImpl((GSSCredentialImpl)cred);
26629
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    46
        }
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    47
    }
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    48
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    49
    public GSSContext wrap(GSSContext ctxt) {
41372
893bf8209c04 8167181: Exported elements referring to inaccessible types in jdk.security.jgss
weijun
parents: 26630
diff changeset
    50
        if (ctxt instanceof ExtendedGSSContextImpl) {
26629
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    51
            return ctxt;
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    52
        } else {
41372
893bf8209c04 8167181: Exported elements referring to inaccessible types in jdk.security.jgss
weijun
parents: 26630
diff changeset
    53
            return new ExtendedGSSContextImpl((GSSContextImpl)ctxt);
26629
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    54
        }
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    55
    }
3b9ed8175488 8042900: Allow com.sun.security.jgss to be in different module than org.ietf.jgss
weijun
parents:
diff changeset
    56
}