Path: blob/master/src/java.security.jgss/share/classes/sun/security/jgss/JgssExtender.java
41159 views
/*1* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.security.jgss;2627import org.ietf.jgss.GSSContext;28import org.ietf.jgss.GSSCredential;2930/**31* The extending point of basic JGSS-API.32* <p>33* If a module wants to extend basic JGSS-API classes, it should extends this34* class and register itself as "the extender" using the setExtender method.35* When various GSSManager.createXXX methods are called, they will call36* "the extender"'s wrap methods to create objects of extended types37* instead of basic types.38* <p>39* We have only one extension now defined in com.sun.security.jgss, and the40* registering process is triggered in {@link GSSManagerImpl} by calling41* Class.forName("com.sun.security.jgss.Extender"). Only GSSContext42* and GSSCredential are extended now.43* <p>44* The setExtender method should be called before any JGSS call.45*/46public class JgssExtender {4748// "The extender"49private static volatile JgssExtender theOne = new JgssExtender();5051/**52* Gets "the extender". GSSManager calls this method so that it can53* wrap basic objects into extended objects.54* @return the extender55*/56public static JgssExtender getExtender() {57return theOne;58}5960/**61* Set "the extender" so that GSSManager can create extended objects.62*/63protected static void setExtender(JgssExtender theOne) {64JgssExtender.theOne = theOne;65}6667/**68* Wraps a plain GSSCredential object into an extended type.69*/70public GSSCredential wrap(GSSCredential cred) {71return cred;72}7374/**75* Wraps a plain GSSContext object into an extended type.76*/77public GSSContext wrap(GSSContext ctxt) {78return ctxt;79}80}818283