├── BUILD ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── WORKSPACE └── java ├── com └── sun │ ├── naming │ └── internal │ │ ├── FactoryEnumeration.java │ │ ├── NamedWeakReference.java │ │ ├── ResourceManager.java │ │ ├── VersionHelper.java │ │ └── VersionHelper12.java │ └── security │ ├── auth │ └── module │ │ └── Krb5LoginModule.java │ └── jgss │ ├── AuthorizationDataEntry.java │ ├── ExtendedGSSContext.java │ ├── ExtendedGSSCredential.java │ ├── GSSUtil.java │ ├── InquireSecContextPermission.java │ └── InquireType.java ├── krb └── javax │ ├── naming │ ├── AuthenticationException.java │ ├── AuthenticationNotSupportedException.java │ ├── BinaryRefAddr.java │ ├── Binding.java │ ├── CannotProceedException.java │ ├── CommunicationException.java │ ├── CompositeName.java │ ├── CompoundName.java │ ├── ConfigurationException.java │ ├── Context.java │ ├── ContextNotEmptyException.java │ ├── InitialContext.java │ ├── InsufficientResourcesException.java │ ├── InterruptedNamingException.java │ ├── InvalidNameException.java │ ├── LimitExceededException.java │ ├── LinkException.java │ ├── LinkLoopException.java │ ├── LinkRef.java │ ├── MalformedLinkException.java │ ├── Name.java │ ├── NameAlreadyBoundException.java │ ├── NameClassPair.java │ ├── NameImpl.java │ ├── NameNotFoundException.java │ ├── NameParser.java │ ├── NamingEnumeration.java │ ├── NamingException.java │ ├── NamingSecurityException.java │ ├── NoInitialContextException.java │ ├── NoPermissionException.java │ ├── NotContextException.java │ ├── OperationNotSupportedException.java │ ├── PartialResultException.java │ ├── RefAddr.java │ ├── Reference.java │ ├── Referenceable.java │ ├── ReferralException.java │ ├── ServiceUnavailableException.java │ ├── SizeLimitExceededException.java │ ├── StringRefAddr.java │ ├── TimeLimitExceededException.java │ ├── directory │ │ ├── Attribute.java │ │ ├── AttributeInUseException.java │ │ ├── AttributeModificationException.java │ │ ├── Attributes.java │ │ ├── BasicAttribute.java │ │ ├── BasicAttributes.java │ │ ├── DirContext.java │ │ ├── InitialDirContext.java │ │ ├── InvalidAttributeIdentifierException.java │ │ ├── InvalidAttributeValueException.java │ │ ├── InvalidAttributesException.java │ │ ├── InvalidSearchControlsException.java │ │ ├── InvalidSearchFilterException.java │ │ ├── ModificationItem.java │ │ ├── NoSuchAttributeException.java │ │ ├── SchemaViolationException.java │ │ ├── SearchControls.java │ │ └── SearchResult.java │ └── spi │ │ ├── ContinuationContext.java │ │ ├── ContinuationDirContext.java │ │ ├── DirObjectFactory.java │ │ ├── DirStateFactory.java │ │ ├── DirectoryManager.java │ │ ├── InitialContextFactory.java │ │ ├── InitialContextFactoryBuilder.java │ │ ├── NamingManager.java │ │ ├── ObjectFactory.java │ │ ├── ObjectFactoryBuilder.java │ │ ├── ResolveResult.java │ │ ├── Resolver.java │ │ └── StateFactory.java │ └── security │ └── auth │ ├── RefreshFailedException.java │ ├── Refreshable.java │ ├── callback │ └── NameCallback.java │ ├── kerberos │ ├── DelegationPermission.java │ ├── JavaxSecurityAuthKerberosAccessImpl.java │ ├── KerberosKey.java │ ├── KerberosPrincipal.java │ ├── KerberosTicket.java │ ├── KeyImpl.java │ ├── KeyTab.java │ └── ServicePermission.java │ ├── login │ ├── AppConfigurationEntry.java │ ├── Configuration.java │ └── ConfigurationSpi.java │ └── spi │ └── LoginModule.java ├── org └── ietf │ └── jgss │ ├── ChannelBinding.java │ ├── GSSContext.java │ ├── GSSCredential.java │ ├── GSSException.java │ ├── GSSManager.java │ ├── GSSName.java │ ├── MessageProp.java │ └── Oid.java └── sun ├── misc ├── CharacterEncoder.java ├── HexDumpEncoder.java └── IOUtils.java ├── net ├── dns │ └── ResolverConfiguration.java └── www │ ├── ParseUtil.java │ └── protocol │ └── http │ ├── HttpCallerInfo.java │ ├── Negotiator.java │ └── spnego │ ├── NegotiateCallbackHandler.java │ └── NegotiatorImpl.java ├── security ├── action │ ├── GetBooleanAction.java │ ├── GetBooleanSecurityPropertyAction.java │ ├── GetIntegerAction.java │ ├── GetLongAction.java │ ├── GetPropertyAction.java │ ├── OpenFileInputStreamAction.java │ └── PutAllAction.java ├── jca │ ├── GetInstance.java │ ├── ProviderConfig.java │ ├── ProviderList.java │ ├── Providers.java │ └── ServiceId.java ├── jgss │ ├── GSSCaller.java │ ├── GSSContextImpl.java │ ├── GSSCredentialImpl.java │ ├── GSSExceptionImpl.java │ ├── GSSHeader.java │ ├── GSSManagerImpl.java │ ├── GSSNameImpl.java │ ├── GSSToken.java │ ├── GSSUtil.java │ ├── HttpCaller.java │ ├── LoginConfigImpl.java │ ├── ProviderList.java │ ├── SunProvider.java │ ├── TokenTracker.java │ ├── krb5 │ │ ├── AcceptSecContextToken.java │ │ ├── CipherHelper.java │ │ ├── InitSecContextToken.java │ │ ├── InitialToken.java │ │ ├── Krb5AcceptCredential.java │ │ ├── Krb5Context.java │ │ ├── Krb5CredElement.java │ │ ├── Krb5InitCredential.java │ │ ├── Krb5MechFactory.java │ │ ├── Krb5NameElement.java │ │ ├── Krb5ProxyCredential.java │ │ ├── Krb5Token.java │ │ ├── Krb5Util.java │ │ ├── MessageToken.java │ │ ├── MessageToken_v2.java │ │ │ └── MessageToken_v2.java │ │ ├── MicToken.java │ │ ├── MicToken_v2.java │ │ │ └── MicToken_v2.java │ │ ├── ServiceCreds.java │ │ ├── SubjectComber.java │ │ ├── WrapToken.java │ │ └── WrapToken_v2.java │ │ │ └── WrapToken_v2.java │ ├── spi │ │ ├── GSSContextSpi.java │ │ ├── GSSCredentialSpi.java │ │ ├── GSSNameSpi.java │ │ └── MechanismFactory.java │ ├── spnego │ │ ├── NegTokenInit.java │ │ ├── NegTokenTarg.java │ │ ├── SpNegoContext.java │ │ ├── SpNegoCredElement.java │ │ ├── SpNegoMechFactory.java │ │ └── SpNegoToken.java │ └── wrapper │ │ ├── GSSCredElement.java │ │ ├── GSSLibStub.java │ │ ├── GSSNameElement.java │ │ ├── Krb5Util.java │ │ ├── NativeGSSContext.java │ │ ├── NativeGSSFactory.java │ │ └── SunNativeProvider.java ├── krb5 │ ├── Asn1Exception.java │ ├── Checksum.java │ ├── Config.java │ ├── Confounder.java │ ├── Credentials.java │ ├── EncryptedData.java │ ├── EncryptionKey.java │ ├── JavaxSecurityAuthKerberosAccess.java │ ├── KdcComm.java │ ├── KerberosSecrets.java │ ├── KrbApRep.java │ ├── KrbApReq.java │ ├── KrbAppMessage.java │ ├── KrbAsRep.java │ ├── KrbAsReq.java │ ├── KrbAsReqBuilder.java │ ├── KrbCred.java │ ├── KrbCryptoException.java │ ├── KrbException.java │ ├── KrbKdcRep.java │ ├── KrbPriv.java │ ├── KrbSafe.java │ ├── KrbServiceLocator.java │ ├── KrbTgsRep.java │ ├── KrbTgsReq.java │ ├── PrincipalName.java │ ├── Realm.java │ ├── RealmException.java │ ├── SCDynamicStoreConfig.java │ └── internal │ │ ├── APOptions.java │ │ ├── APRep.java │ │ ├── APReq.java │ │ ├── ASRep.java │ │ ├── ASReq.java │ │ ├── AuthContext.java │ │ ├── Authenticator.java │ │ ├── AuthorizationData.java │ │ ├── AuthorizationDataEntry.java │ │ ├── CredentialsUtil.java │ │ ├── ETypeInfo.java │ │ ├── ETypeInfo2.java │ │ ├── EncAPRepPart.java │ │ ├── EncASRepPart.java │ │ ├── EncKDCRepPart.java │ │ ├── EncKrbCredPart.java │ │ ├── EncKrbPrivPart.java │ │ ├── EncTGSRepPart.java │ │ ├── EncTicketPart.java │ │ ├── HostAddress.java │ │ ├── HostAddresses.java │ │ ├── KDCOptions.java │ │ ├── KDCRep.java │ │ ├── KDCReq.java │ │ ├── KDCReqBody.java │ │ ├── KRBCred.java │ │ ├── KRBError.java │ │ ├── KRBPriv.java │ │ ├── KRBSafe.java │ │ ├── KRBSafeBody.java │ │ ├── KdcErrException.java │ │ ├── KerberosTime.java │ │ ├── Krb5.java │ │ ├── KrbApErrException.java │ │ ├── KrbCredInfo.java │ │ ├── KrbErrException.java │ │ ├── LastReq.java │ │ ├── LastReqEntry.java │ │ ├── LocalSeqNumber.java │ │ ├── LoginOptions.java │ │ ├── MethodData.java │ │ ├── NetClient.java │ │ ├── PAData.java │ │ ├── PAEncTSEnc.java │ │ ├── PAForUserEnc.java │ │ ├── ReplayCache.java │ │ ├── SeqNumber.java │ │ ├── TGSRep.java │ │ ├── TGSReq.java │ │ ├── Ticket.java │ │ ├── TicketFlags.java │ │ ├── TransitedEncoding.java │ │ ├── ccache │ │ ├── CCacheInputStream.java │ │ ├── CCacheOutputStream.java │ │ ├── Credentials.java │ │ ├── CredentialsCache.java │ │ ├── FileCCacheConstants.java │ │ ├── FileCredentialsCache.java │ │ ├── MemoryCredentialsCache.java │ │ └── Tag.java │ │ ├── crypto │ │ ├── Aes128.java │ │ ├── Aes128CtsHmacSha1EType.java │ │ ├── Aes256.java │ │ ├── Aes256CtsHmacSha1EType.java │ │ ├── ArcFourHmac.java │ │ ├── ArcFourHmacEType.java │ │ ├── CksumType.java │ │ ├── Crc32CksumType.java │ │ ├── Des.java │ │ ├── Des3.java │ │ ├── Des3CbcHmacSha1KdEType.java │ │ ├── DesCbcCrcEType.java │ │ ├── DesCbcEType.java │ │ ├── DesCbcMd5EType.java │ │ ├── DesMacCksumType.java │ │ ├── DesMacKCksumType.java │ │ ├── EType.java │ │ ├── HmacMd5ArcFourCksumType.java │ │ ├── HmacSha1Aes128CksumType.java │ │ ├── HmacSha1Aes256CksumType.java │ │ ├── HmacSha1Des3KdCksumType.java │ │ ├── KeyUsage.java │ │ ├── Nonce.java │ │ ├── NullEType.java │ │ ├── RsaMd5CksumType.java │ │ ├── RsaMd5DesCksumType.java │ │ ├── crc32.java │ │ └── dk │ │ │ ├── AesDkCrypto.java │ │ │ ├── ArcFourCrypto.java │ │ │ ├── Des3DkCrypto.java │ │ │ └── DkCrypto.java │ │ ├── ktab │ │ ├── KeyTab.java │ │ ├── KeyTabConstants.java │ │ ├── KeyTabEntry.java │ │ ├── KeyTabInputStream.java │ │ └── KeyTabOutputStream.java │ │ ├── rcache │ │ ├── AuthList.java │ │ ├── AuthTime.java │ │ ├── AuthTimeWithHash.java │ │ ├── DflCache.java │ │ └── MemoryCache.java │ │ └── util │ │ ├── KerberosFlags.java │ │ ├── KerberosString.java │ │ ├── KrbDataInputStream.java │ │ └── KrbDataOutputStream.java └── util │ ├── AuthResources.java │ ├── BitArray.java │ ├── ByteArrayLexOrder.java │ ├── ByteArrayTagOrder.java │ ├── DerEncoder.java │ ├── DerIndefLenConverter.java │ ├── DerInputBuffer.java │ ├── DerInputStream.java │ ├── DerOutputStream.java │ ├── DerValue.java │ ├── ObjectIdentifier.java │ └── PropertyExpander.java └── util └── calendar ├── AbstractCalendar.java ├── BaseCalendar.java ├── CalendarDate.java ├── CalendarSystem.java ├── CalendarUtils.java ├── Era.java ├── Gregorian.java ├── ImmutableGregorianDate.java ├── JulianCalendar.java ├── LocalGregorianCalendar.java ├── ZoneInfo.java └── ZoneInfoFile.java /BUILD: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Implementation of the Kerberos protocol from OpenJDK 3 | load("@build_bazel_rules_android//android:rules.bzl", "android_library") 4 | 5 | licenses(["restricted"]) 6 | 7 | exports_files(["LICENSE"]) 8 | 9 | android_library( 10 | name = "openjdk_kerberos", 11 | visibility = ["//visibility:public"], 12 | srcs = glob(["java/**/*.java"]), 13 | javacopts = ["-Xep:AndroidJdkLibsChecker:OFF"], 14 | ) 15 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to this project must be accompanied by a Contributor License 9 | Agreement. You (or your employer) retain the copyright to your contribution; 10 | this simply gives us permission to use and redistribute your contributions as 11 | part of the project. Head over to to see 12 | your current agreements on file or to sign a new one. 13 | 14 | You generally only need to submit a CLA once, so if you've already submitted one 15 | (even if it was for a different project), you probably don't need to do it 16 | again. 17 | 18 | ## Code reviews 19 | 20 | All submissions, including submissions by project members, require review. We 21 | use GitHub pull requests for this purpose. Consult 22 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more 23 | information on using pull requests. 24 | 25 | ## Community Guidelines 26 | 27 | This project follows 28 | [Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenJDK Kerberos Implementation 2 | 3 | A subset of OpenJDK containing an implementation of the Kerberos protocol, built for use on Android. 4 | 5 | ## NOTE 6 | This is not an officially supported Google product. 7 | It is provided as a way to help other Android developers build products that utilize Kerberos. 8 | 9 | ## About 10 | The code in this package is an adaptation of the Kerberos implementation from [OpenJDK](https://openjdk.java.net/), 11 | intended for use in Android applications. 12 | 13 | ## Building 14 | A JAR file suitable for inclusion in Android apps can be built using 15 | [Bazel](https://docs.bazel.build/versions/master/bazel-overview.html). 16 | 17 | ## Using 18 | For the most part, the standard GSS-API can be used, particularly classes under `org.ietf.jgss`, as well as the `Krb5LoginModule`. 19 | 20 | ## Local changes 21 | As the Android SDK includes some of the relevant source files, with some 22 | modifications, a few changes have been made to get the code to cleanly 23 | compile and work with an Android app. 24 | 25 | ### Namespace changes 26 | Relevant classes under `javax.naming` and `javax.security` have been prefixed 27 | with `krb`, so are now under `krb.javax.naming` and `krb.javax.security`. 28 | 29 | ### Ticket storage 30 | Since the Android SDK does not properly implement a `SecurityManager`, 31 | the `Subject` instance containing the ticket from a Kerberos authentication 32 | cannot be obtained via the implementation of the GSS API. 33 | 34 | To address that, a new method has been added to `sun.security.jgss.GSSUtil`, 35 | `setGlobalSubject(Subject subject)`. 36 | 37 | This method sets a `Subject` instance that will be used as the context for all GSS 38 | calls. 39 | 40 | The caller should take care to clear the global context by setting a `null` subject 41 | after the GSS-related operations have been completed. 42 | 43 | ## Contributing 44 | The [CONTRIBUTING.md](CONTRIBUTING.md) file contains instructions on how to 45 | submit the Contributor License Agreement before sending any pull requests (PRs). 46 | Of course, if you're new to the project, it's usually best to discuss any 47 | proposals and reach consensus before sending your first PR. 48 | 49 | ## License 50 | This package retains the OpenJDK original license, which is The GNU General 51 | Public License (GPL) Version 2 with the Classpath Exception. See the 52 | [LICENSE](LICENSE) file. 53 | -------------------------------------------------------------------------------- /WORKSPACE: -------------------------------------------------------------------------------- 1 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 2 | http_archive( 3 | name = "build_bazel_rules_android", 4 | urls = ["https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"], 5 | sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", 6 | strip_prefix = "rules_android-0.1.1", 7 | ) 8 | android_sdk_repository( 9 | name = "androidsdk", 10 | api_level = 27, 11 | build_tools_version = "26.0.1", 12 | ) 13 | -------------------------------------------------------------------------------- /java/com/sun/naming/internal/NamedWeakReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package com.sun.naming.internal; 27 | 28 | 29 | /** 30 | * A NamedWeakReference is a WeakReference with an immutable string name. 31 | * 32 | * @author Scott Seligman 33 | */ 34 | 35 | 36 | class NamedWeakReference extends java.lang.ref.WeakReference { 37 | 38 | private final String name; 39 | 40 | NamedWeakReference(T referent, String name) { 41 | super(referent); 42 | this.name = name; 43 | } 44 | 45 | String getName() { 46 | return name; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /java/com/sun/security/jgss/AuthorizationDataEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package com.sun.security.jgss; 27 | 28 | /** 29 | * Kerberos 5 AuthorizationData entry. 30 | */ 31 | 32 | public final class AuthorizationDataEntry { 33 | 34 | private final int type; 35 | private final byte[] data; 36 | 37 | /** 38 | * Create an AuthorizationDataEntry object. 39 | * @param type the ad-type 40 | * @param data the ad-data, a copy of the data will be saved 41 | * inside the object. 42 | */ 43 | public AuthorizationDataEntry(int type, byte[] data) { 44 | this.type = type; 45 | this.data = data.clone(); 46 | } 47 | 48 | /** 49 | * Get the ad-type field. 50 | * @return ad-type 51 | */ 52 | public int getType() { 53 | return type; 54 | } 55 | 56 | /** 57 | * Get a copy of the ad-data field. 58 | * @return ad-data 59 | */ 60 | public byte[] getData() { 61 | return data.clone(); 62 | } 63 | 64 | public String toString() { 65 | return "AuthorizationDataEntry: type="+type+", data=" + 66 | data.length + " bytes:\n" + 67 | new sun.misc.HexDumpEncoder().encodeBuffer(data); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /java/com/sun/security/jgss/ExtendedGSSCredential.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package com.sun.security.jgss; 27 | 28 | import org.ietf.jgss.*; 29 | 30 | /** 31 | * The extended GSSCredential interface for supporting additional 32 | * functionalities not defined by {@code org.ietf.jgss.GSSCredential}. 33 | * @since 1.8 34 | */ 35 | 36 | public interface ExtendedGSSCredential extends GSSCredential { 37 | /** 38 | * Impersonates a principal. In Kerberos, this can be implemented 39 | * using the Microsoft S4U2self extension. 40 | *

41 | * A {@link GSSException#NO_CRED GSSException.NO_CRED} will be thrown if the 42 | * impersonation fails. A {@link GSSException#FAILURE GSSException.FAILURE} 43 | * will be thrown if the impersonation method is not available to this 44 | * credential object. 45 | * @param name the name of the principal to impersonate 46 | * @return a credential for that principal 47 | * @throws GSSException containing the following 48 | * major error codes: 49 | * {@link GSSException#NO_CRED GSSException.NO_CRED} 50 | * {@link GSSException#FAILURE GSSException.FAILURE} 51 | */ 52 | public GSSCredential impersonate(GSSName name) throws GSSException; 53 | } 54 | -------------------------------------------------------------------------------- /java/com/sun/security/jgss/InquireSecContextPermission.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package com.sun.security.jgss; 27 | 28 | import java.security.BasicPermission; 29 | 30 | /** 31 | * This class is used to protect various attributes of an established 32 | * GSS security context that can be accessed using the 33 | * {@link com.sun.security.jgss.ExtendedGSSContext#inquireSecContext} 34 | * method. 35 | * 36 | *

The target name is the {@link InquireType} allowed. 37 | */ 38 | 39 | public final class InquireSecContextPermission extends BasicPermission { 40 | private static final long serialVersionUID = -7131173349668647297L; 41 | 42 | /** 43 | * Constructs a new {@code InquireSecContextPermission} object with 44 | * the specified name. The name is the symbolic name of the 45 | * {@link InquireType} allowed. 46 | * 47 | * @param name the {@link InquireType} allowed by this 48 | * permission. "*" means all {@link InquireType}s are allowed. 49 | * 50 | * @throws NullPointerException if name is null. 51 | * @throws IllegalArgumentException if name is empty. 52 | */ 53 | public InquireSecContextPermission(String name) { 54 | super(name); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /java/com/sun/security/jgss/InquireType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package com.sun.security.jgss; 27 | 28 | /** 29 | * Attribute types that can be specified as an argument of 30 | * {@link com.sun.security.jgss.ExtendedGSSContext#inquireSecContext} 31 | */ 32 | 33 | public enum InquireType { 34 | /** 35 | * Attribute type for retrieving the session key of an 36 | * established Kerberos 5 security context. 37 | */ 38 | KRB5_GET_SESSION_KEY, 39 | /** 40 | * Attribute type for retrieving the service ticket flags of an 41 | * established Kerberos 5 security context. 42 | */ 43 | KRB5_GET_TKT_FLAGS, 44 | /** 45 | * Attribute type for retrieving the authorization data in the 46 | * service ticket of an established Kerberos 5 security context. 47 | * Only supported on the acceptor side. 48 | */ 49 | KRB5_GET_AUTHZ_DATA, 50 | /** 51 | * Attribute type for retrieving the authtime in the service ticket 52 | * of an established Kerberos 5 security context. 53 | */ 54 | KRB5_GET_AUTHTIME 55 | } 56 | -------------------------------------------------------------------------------- /java/krb/javax/naming/AuthenticationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when an authentication error occurs while 30 | * accessing the naming or directory service. 31 | * An authentication error can happen, for example, when the credentials 32 | * supplied by the user program is invalid or otherwise fails to 33 | * authenticate the user to the naming/directory service. 34 | *

35 | * If the program wants to handle this exception in particular, it 36 | * should catch AuthenticationException explicitly before attempting to 37 | * catch NamingException. After catching AuthenticationException, the 38 | * program could reattempt the authentication by updating 39 | * the resolved context's environment properties with the appropriate 40 | * appropriate credentials. 41 | *

42 | * Synchronization and serialization issues that apply to NamingException 43 | * apply directly here. 44 | * 45 | * @author Rosanna Lee 46 | * @author Scott Seligman 47 | * @since 1.3 48 | */ 49 | 50 | public class AuthenticationException extends NamingSecurityException { 51 | /** 52 | * Constructs a new instance of AuthenticationException using the 53 | * explanation supplied. All other fields default to null. 54 | * 55 | * @param explanation A possibly null string containing 56 | * additional detail about this exception. 57 | * @see java.lang.Throwable#getMessage 58 | */ 59 | public AuthenticationException(String explanation) { 60 | super(explanation); 61 | } 62 | 63 | /** 64 | * Constructs a new instance of AuthenticationException. 65 | * All fields are set to null. 66 | */ 67 | public AuthenticationException() { 68 | super(); 69 | } 70 | 71 | /** 72 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 73 | */ 74 | private static final long serialVersionUID = 3678497619904568096L; 75 | } 76 | -------------------------------------------------------------------------------- /java/krb/javax/naming/CommunicationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when the client is 30 | * unable to communicate with the directory or naming service. 31 | * The inability to communicate with the service might be a result 32 | * of many factors, such as network partitioning, hardware or interface problems, 33 | * failures on either the client or server side. 34 | * This exception is meant to be used to capture such communication problems. 35 | *

36 | * Synchronization and serialization issues that apply to NamingException 37 | * apply directly here. 38 | * 39 | * @author Rosanna Lee 40 | * @author Scott Seligman 41 | * @since 1.3 42 | */ 43 | public class CommunicationException extends NamingException { 44 | /** 45 | * Constructs a new instance of CommunicationException using the 46 | * arguments supplied. 47 | * 48 | * @param explanation Additional detail about this exception. 49 | * @see java.lang.Throwable#getMessage 50 | */ 51 | public CommunicationException(String explanation) { 52 | super(explanation); 53 | } 54 | 55 | /** 56 | * Constructs a new instance of CommunicationException. 57 | */ 58 | public CommunicationException() { 59 | super(); 60 | } 61 | 62 | /** 63 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 64 | */ 65 | private static final long serialVersionUID = 3618507780299986611L; 66 | } 67 | -------------------------------------------------------------------------------- /java/krb/javax/naming/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when there is a configuration problem. 30 | * This can arise when installation of a provider was 31 | * not done correctly, or if there are configuration problems with the 32 | * server, or if configuration information required to access 33 | * the provider or service is malformed or missing. 34 | * For example, a request to use SSL as the security protocol when 35 | * the service provider software was not configured with the SSL 36 | * component would cause such an exception. Another example is 37 | * if the provider requires that a URL be specified as one of the 38 | * environment properties but the client failed to provide it. 39 | *

40 | * Synchronization and serialization issues that apply to NamingException 41 | * apply directly here. 42 | * 43 | * @author Rosanna Lee 44 | * @author Scott Seligman 45 | * @since 1.3 46 | */ 47 | public class ConfigurationException extends NamingException { 48 | /** 49 | * Constructs a new instance of ConfigurationException using an 50 | * explanation. All other fields default to null. 51 | * 52 | * @param explanation A possibly null string containing 53 | * additional detail about this exception. 54 | * @see java.lang.Throwable#getMessage 55 | */ 56 | public ConfigurationException(String explanation) { 57 | super(explanation); 58 | } 59 | 60 | /** 61 | * Constructs a new instance of ConfigurationException with 62 | * all name resolution fields and explanation initialized to null. 63 | */ 64 | public ConfigurationException() { 65 | super(); 66 | } 67 | 68 | /** 69 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 70 | */ 71 | private static final long serialVersionUID = -2535156726228855704L; 72 | } 73 | -------------------------------------------------------------------------------- /java/krb/javax/naming/ContextNotEmptyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when attempting to destroy a context that 30 | * is not empty. 31 | *

32 | * If the program wants to handle this exception in particular, it 33 | * should catch ContextNotEmptyException explicitly before attempting to 34 | * catch NamingException. For example, after catching ContextNotEmptyException, 35 | * the program might try to remove the contents of the context before 36 | * reattempting the destroy. 37 | *

38 | * Synchronization and serialization issues that apply to NamingException 39 | * apply directly here. 40 | * 41 | * @author Rosanna Lee 42 | * @author Scott Seligman 43 | * 44 | * @see Context#destroySubcontext 45 | * @since 1.3 46 | */ 47 | public class ContextNotEmptyException extends NamingException { 48 | /** 49 | * Constructs a new instance of ContextNotEmptyException using an 50 | * explanation. All other fields default to null. 51 | * 52 | * @param explanation Possibly null string containing 53 | * additional detail about this exception. 54 | * @see java.lang.Throwable#getMessage 55 | */ 56 | public ContextNotEmptyException(String explanation) { 57 | super(explanation); 58 | } 59 | 60 | /** 61 | * Constructs a new instance of ContextNotEmptyException with 62 | * all name resolution fields and explanation initialized to null. 63 | */ 64 | public ContextNotEmptyException() { 65 | super(); 66 | } 67 | 68 | /** 69 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 70 | */ 71 | private static final long serialVersionUID = 1090963683348219877L; 72 | } 73 | -------------------------------------------------------------------------------- /java/krb/javax/naming/InsufficientResourcesException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when resources are not available to complete 30 | * the requested operation. This might due to a lack of resources on 31 | * the server or on the client. There are no restrictions to resource types, 32 | * as different services might make use of different resources. Such 33 | * restrictions might be due to physical limits and/or administrative quotas. 34 | * Examples of limited resources are internal buffers, memory, network bandwidth. 35 | *

36 | * InsufficientResourcesException is different from LimitExceededException in that 37 | * the latter is due to user/system specified limits. See LimitExceededException 38 | * for details. 39 | *

40 | * Synchronization and serialization issues that apply to NamingException 41 | * apply directly here. 42 | * 43 | * @author Rosanna Lee 44 | * @author Scott Seligman 45 | * @since 1.3 46 | */ 47 | 48 | public class InsufficientResourcesException extends NamingException { 49 | /** 50 | * Constructs a new instance of InsufficientResourcesException using an 51 | * explanation. All other fields default to null. 52 | * 53 | * @param explanation Possibly null additional detail about this exception. 54 | * @see java.lang.Throwable#getMessage 55 | */ 56 | public InsufficientResourcesException(String explanation) { 57 | super(explanation); 58 | } 59 | 60 | /** 61 | * Constructs a new instance of InsufficientResourcesException with 62 | * all name resolution fields and explanation initialized to null. 63 | */ 64 | public InsufficientResourcesException() { 65 | super(); 66 | } 67 | 68 | /** 69 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 70 | */ 71 | private static final long serialVersionUID = 6227672693037844532L; 72 | } 73 | -------------------------------------------------------------------------------- /java/krb/javax/naming/InterruptedNamingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when the naming operation 30 | * being invoked has been interrupted. For example, an application 31 | * might interrupt a thread that is performing a search. If the 32 | * search supports being interrupted, it will throw 33 | * InterruptedNamingException. Whether an operation is interruptible 34 | * and when depends on its implementation (as provided by the 35 | * service providers). Different implementations have different ways 36 | * of protecting their resources and objects from being damaged 37 | * due to unexpected interrupts. 38 | *

39 | * Synchronization and serialization issues that apply to NamingException 40 | * apply directly here. 41 | * 42 | * @author Rosanna Lee 43 | * @author Scott Seligman 44 | * 45 | * @see Context 46 | * @see krb.javax.naming.directory.DirContext 47 | * @see java.lang.Thread#interrupt 48 | * @see java.lang.InterruptedException 49 | * @since 1.3 50 | */ 51 | 52 | public class InterruptedNamingException extends NamingException { 53 | /** 54 | * Constructs an instance of InterruptedNamingException using an 55 | * explanation of the problem. 56 | * All name resolution-related fields are initialized to null. 57 | * @param explanation A possibly null message explaining the problem. 58 | * @see java.lang.Throwable#getMessage 59 | */ 60 | public InterruptedNamingException(String explanation) { 61 | super(explanation); 62 | } 63 | 64 | /** 65 | * Constructs an instance of InterruptedNamingException with 66 | * all name resolution fields and explanation initialized to null. 67 | */ 68 | public InterruptedNamingException() { 69 | super(); 70 | } 71 | 72 | /** 73 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 74 | */ 75 | private static final long serialVersionUID = 6404516648893194728L; 76 | } 77 | -------------------------------------------------------------------------------- /java/krb/javax/naming/InvalidNameException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception indicates that the name being specified does 30 | * not conform to the naming syntax of a naming system. 31 | * This exception is thrown by any of the methods that does name 32 | * parsing (such as those in Context, DirContext, CompositeName and CompoundName). 33 | *

34 | * Synchronization and serialization issues that apply to NamingException 35 | * apply directly here. 36 | * 37 | * @author Rosanna Lee 38 | * @author Scott Seligman 39 | * 40 | * @see Context 41 | * @see krb.javax.naming.directory.DirContext 42 | * @see CompositeName 43 | * @see CompoundName 44 | * @see NameParser 45 | * @since 1.3 46 | */ 47 | 48 | public class InvalidNameException extends NamingException { 49 | /** 50 | * Constructs an instance of InvalidNameException using an 51 | * explanation of the problem. 52 | * All other fields are initialized to null. 53 | * @param explanation A possibly null message explaining the problem. 54 | * @see java.lang.Throwable#getMessage 55 | */ 56 | public InvalidNameException(String explanation) { 57 | super(explanation); 58 | } 59 | 60 | /** 61 | * Constructs an instance of InvalidNameException with 62 | * all fields set to null. 63 | */ 64 | public InvalidNameException() { 65 | super(); 66 | } 67 | 68 | /** 69 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 70 | */ 71 | private static final long serialVersionUID = -8370672380823801105L; 72 | } 73 | -------------------------------------------------------------------------------- /java/krb/javax/naming/LimitExceededException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | 27 | package krb.javax.naming; 28 | 29 | import krb.javax.naming.Name; 30 | 31 | /** 32 | * This exception is thrown when a method 33 | * terminates abnormally due to a user or system specified limit. 34 | * This is different from a InsufficientResourceException in that 35 | * LimitExceededException is due to a user/system specified limit. 36 | * For example, running out of memory to complete the request would 37 | * be an insufficient resource. The client asking for 10 answers and 38 | * getting back 11 is a size limit exception. 39 | *

40 | * Examples of these limits include client and server configuration 41 | * limits such as size, time, number of hops, etc. 42 | *

43 | * Synchronization and serialization issues that apply to NamingException 44 | * apply directly here. 45 | * 46 | * @author Rosanna Lee 47 | * @author Scott Seligman 48 | * @since 1.3 49 | */ 50 | 51 | public class LimitExceededException extends NamingException { 52 | /** 53 | * Constructs a new instance of LimitExceededException with 54 | * all name resolution fields and explanation initialized to null. 55 | */ 56 | public LimitExceededException() { 57 | super(); 58 | } 59 | 60 | /** 61 | * Constructs a new instance of LimitExceededException using an 62 | * explanation. All other fields default to null. 63 | * @param explanation Possibly null detail about this exception. 64 | * @see java.lang.Throwable#getMessage 65 | */ 66 | public LimitExceededException(String explanation) { 67 | super(explanation); 68 | } 69 | 70 | /** 71 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 72 | */ 73 | private static final long serialVersionUID = -776898738660207856L; 74 | } 75 | -------------------------------------------------------------------------------- /java/krb/javax/naming/LinkLoopException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when 30 | * a loop was detected will attempting to resolve a link, or an implementation 31 | * specific limit on link counts has been reached. 32 | *

33 | * Synchronization and serialization issues that apply to LinkException 34 | * apply directly here. 35 | * 36 | * @author Rosanna Lee 37 | * @author Scott Seligman 38 | * 39 | * @see LinkRef 40 | * @since 1.3 41 | */ 42 | 43 | public class LinkLoopException extends LinkException { 44 | /** 45 | * Constructs a new instance of LinkLoopException with an explanation 46 | * All the other fields are initialized to null. 47 | * @param explanation A possibly null string containing additional 48 | * detail about this exception. 49 | * @see java.lang.Throwable#getMessage 50 | */ 51 | public LinkLoopException(String explanation) { 52 | super(explanation); 53 | } 54 | 55 | /** 56 | * Constructs a new instance of LinkLoopException. 57 | * All the non-link-related and link-related fields are initialized to null. 58 | */ 59 | public LinkLoopException() { 60 | super(); 61 | } 62 | 63 | /** 64 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 65 | */ 66 | private static final long serialVersionUID = -3119189944325198009L; 67 | } 68 | -------------------------------------------------------------------------------- /java/krb/javax/naming/MalformedLinkException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when a malformed link was encountered while 30 | * resolving or constructing a link. 31 | *

32 | * Synchronization and serialization issues that apply to LinkException 33 | * apply directly here. 34 | * 35 | * @author Rosanna Lee 36 | * @author Scott Seligman 37 | * 38 | * @see LinkRef#getLinkName 39 | * @see LinkRef 40 | * @since 1.3 41 | */ 42 | 43 | public class MalformedLinkException extends LinkException { 44 | /** 45 | * Constructs a new instance of MalformedLinkException with an explanation 46 | * All the other fields are initialized to null. 47 | * @param explanation A possibly null string containing additional 48 | * detail about this exception. 49 | */ 50 | public MalformedLinkException(String explanation) { 51 | super(explanation); 52 | } 53 | 54 | 55 | /** 56 | * Constructs a new instance of Malformed LinkException. 57 | * All fields are initialized to null. 58 | */ 59 | public MalformedLinkException() { 60 | super(); 61 | } 62 | 63 | /** 64 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 65 | */ 66 | private static final long serialVersionUID = -3066740437737830242L; 67 | } 68 | -------------------------------------------------------------------------------- /java/krb/javax/naming/NameAlreadyBoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown by methods to indicate that 30 | * a binding cannot be added because the name is already bound to 31 | * another object. 32 | *

33 | * Synchronization and serialization issues that apply to NamingException 34 | * apply directly here. 35 | * 36 | * @author Rosanna Lee 37 | * @author Scott Seligman 38 | * 39 | * @see Context#bind 40 | * @see Context#rebind 41 | * @see Context#createSubcontext 42 | * @see krb.javax.naming.directory.DirContext#bind 43 | * @see krb.javax.naming.directory.DirContext#rebind 44 | * @see krb.javax.naming.directory.DirContext#createSubcontext 45 | * @since 1.3 46 | */ 47 | 48 | public class NameAlreadyBoundException extends NamingException { 49 | /** 50 | * Constructs a new instance of NameAlreadyBoundException using the 51 | * explanation supplied. All other fields default to null. 52 | * 53 | * 54 | * @param explanation Possibly null additional detail about this exception. 55 | * @see java.lang.Throwable#getMessage 56 | */ 57 | public NameAlreadyBoundException(String explanation) { 58 | super(explanation); 59 | } 60 | 61 | /** 62 | * Constructs a new instance of NameAlreadyBoundException. 63 | * All fields are set to null; 64 | */ 65 | public NameAlreadyBoundException() { 66 | super(); 67 | } 68 | 69 | /** 70 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 71 | */ 72 | private static final long serialVersionUID = -8491441000356780586L; 73 | } 74 | -------------------------------------------------------------------------------- /java/krb/javax/naming/NameNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when a component of the name cannot be resolved 30 | * because it is not bound. 31 | *

32 | * Synchronization and serialization issues that apply to NamingException 33 | * apply directly here. 34 | * 35 | * @author Rosanna Lee 36 | * @author Scott Seligman 37 | * @since 1.3 38 | */ 39 | 40 | public class NameNotFoundException extends NamingException { 41 | /** 42 | * Constructs a new instance of NameNotFoundException using the 43 | * explanation supplied. All other fields default to null. 44 | * 45 | * @param explanation Possibly null additional detail about 46 | * this exception. 47 | * @see java.lang.Throwable#getMessage 48 | */ 49 | public NameNotFoundException(String explanation) { 50 | super(explanation); 51 | } 52 | 53 | /** 54 | * Constructs a new instance of NameNotFoundException. 55 | * all name resolution fields and explanation initialized to null. 56 | */ 57 | public NameNotFoundException() { 58 | super(); 59 | } 60 | 61 | /** 62 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 63 | */ 64 | private static final long serialVersionUID = -8007156725367842053L; 65 | } 66 | -------------------------------------------------------------------------------- /java/krb/javax/naming/NameParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This interface is used for parsing names from a hierarchical 30 | * namespace. The NameParser contains knowledge of the syntactic 31 | * information (like left-to-right orientation, name separator, etc.) 32 | * needed to parse names. 33 | * 34 | * The equals() method, when used to compare two NameParsers, returns 35 | * true if and only if they serve the same namespace. 36 | * 37 | * @author Rosanna Lee 38 | * @author Scott Seligman 39 | * 40 | * @see CompoundName 41 | * @see Name 42 | * @since 1.3 43 | */ 44 | 45 | public interface NameParser { 46 | /** 47 | * Parses a name into its components. 48 | * 49 | * @param name The non-null string name to parse. 50 | * @return A non-null parsed form of the name using the naming convention 51 | * of this parser. 52 | * @exception InvalidNameException If name does not conform to 53 | * syntax defined for the namespace. 54 | * @exception NamingException If a naming exception was encountered. 55 | */ 56 | Name parse(String name) throws NamingException; 57 | } 58 | -------------------------------------------------------------------------------- /java/krb/javax/naming/NamingSecurityException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This is the superclass of security-related exceptions 30 | * thrown by operations in the Context and DirContext interfaces. 31 | * The nature of the failure is described by the name of the subclass. 32 | *

33 | * If the program wants to handle this exception in particular, it 34 | * should catch NamingSecurityException explicitly before attempting to 35 | * catch NamingException. A program might want to do this, for example, 36 | * if it wants to treat security-related exceptions specially from 37 | * other sorts of naming exception. 38 | *

39 | * Synchronization and serialization issues that apply to NamingException 40 | * apply directly here. 41 | * 42 | * @author Rosanna Lee 43 | * @author Scott Seligman 44 | * @since 1.3 45 | */ 46 | 47 | public abstract class NamingSecurityException extends NamingException { 48 | /** 49 | * Constructs a new instance of NamingSecurityException using the 50 | * explanation supplied. All other fields default to null. 51 | * 52 | * @param explanation Possibly null additional detail about this exception. 53 | * @see java.lang.Throwable#getMessage 54 | */ 55 | public NamingSecurityException(String explanation) { 56 | super(explanation); 57 | } 58 | 59 | /** 60 | * Constructs a new instance of NamingSecurityException. 61 | * All fields are initialized to null. 62 | */ 63 | public NamingSecurityException() { 64 | super(); 65 | } 66 | 67 | /** 68 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 69 | */ 70 | private static final long serialVersionUID = 5855287647294685775L; 71 | }; 72 | -------------------------------------------------------------------------------- /java/krb/javax/naming/NoInitialContextException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when no initial context implementation 30 | * can be created. The policy of how an initial context implementation 31 | * is selected is described in the documentation of the InitialContext class. 32 | *

33 | * This exception can be thrown during any interaction with the 34 | * InitialContext, not only when the InitialContext is constructed. 35 | * For example, the implementation of the initial context might lazily 36 | * retrieve the context only when actual methods are invoked on it. 37 | * The application should not have any dependency on when the existence 38 | * of an initial context is determined. 39 | *

40 | * Synchronization and serialization issues that apply to NamingException 41 | * apply directly here. 42 | * 43 | * @author Rosanna Lee 44 | * @author Scott Seligman 45 | * 46 | * @see InitialContext 47 | * @see krb.javax.naming.directory.InitialDirContext 48 | * @see krb.javax.naming.spi.NamingManager#getInitialContext 49 | * @see krb.javax.naming.spi.NamingManager#setInitialContextFactoryBuilder 50 | * @since 1.3 51 | */ 52 | public class NoInitialContextException extends NamingException { 53 | /** 54 | * Constructs an instance of NoInitialContextException. 55 | * All fields are initialized to null. 56 | */ 57 | public NoInitialContextException() { 58 | super(); 59 | } 60 | 61 | /** 62 | * Constructs an instance of NoInitialContextException with an 63 | * explanation. All other fields are initialized to null. 64 | * @param explanation Possibly null additional detail about this exception. 65 | * @see java.lang.Throwable#getMessage 66 | */ 67 | public NoInitialContextException(String explanation) { 68 | super(explanation); 69 | } 70 | 71 | /** 72 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 73 | */ 74 | private static final long serialVersionUID = -3413733186901258623L; 75 | } 76 | -------------------------------------------------------------------------------- /java/krb/javax/naming/NoPermissionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when attempting to perform an operation 30 | * for which the client has no permission. The access control/permission 31 | * model is dictated by the directory/naming server. 32 | * 33 | *

34 | * Synchronization and serialization issues that apply to NamingException 35 | * apply directly here. 36 | * 37 | * @author Rosanna Lee 38 | * @author Scott Seligman 39 | * @since 1.3 40 | */ 41 | 42 | public class NoPermissionException extends NamingSecurityException { 43 | /** 44 | * Constructs a new instance of NoPermissionException using an 45 | * explanation. All other fields default to null. 46 | * 47 | * @param explanation Possibly null additional detail about this exception. 48 | */ 49 | public NoPermissionException(String explanation) { 50 | super(explanation); 51 | } 52 | 53 | /** 54 | * Constructs a new instance of NoPermissionException. 55 | * All fields are initialized to null. 56 | */ 57 | public NoPermissionException() { 58 | super(); 59 | } 60 | /** 61 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 62 | */ 63 | private static final long serialVersionUID = 8395332708699751775L; 64 | } 65 | -------------------------------------------------------------------------------- /java/krb/javax/naming/NotContextException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when a naming operation proceeds to a point 30 | * where a context is required to continue the operation, but the 31 | * resolved object is not a context. For example, Context.destroy() requires 32 | * that the named object be a context. If it is not, NotContextException 33 | * is thrown. Another example is a non-context being encountered during 34 | * the resolution phase of the Context methods. 35 | *

36 | * It is also thrown when a particular subtype of context is required, 37 | * such as a DirContext, and the resolved object is a context but not of 38 | * the required subtype. 39 | *

40 | * Synchronization and serialization issues that apply to NamingException 41 | * apply directly here. 42 | * @see Context#destroySubcontext 43 | * 44 | * @author Rosanna Lee 45 | * @author Scott Seligman 46 | * @since 1.3 47 | */ 48 | 49 | public class NotContextException extends NamingException { 50 | /** 51 | * Constructs a new instance of NotContextException using an 52 | * explanation. All other fields default to null. 53 | * 54 | * @param explanation Possibly null additional detail about this exception. 55 | * @see java.lang.Throwable#getMessage 56 | */ 57 | public NotContextException(String explanation) { 58 | super(explanation); 59 | } 60 | 61 | /** 62 | * Constructs a new instance of NotContextException. 63 | * All fields default to null. 64 | */ 65 | public NotContextException() { 66 | super(); 67 | } 68 | 69 | /** 70 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 71 | */ 72 | private static final long serialVersionUID = 849752551644540417L; 73 | } 74 | -------------------------------------------------------------------------------- /java/krb/javax/naming/OperationNotSupportedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when a context implementation does not support 30 | * the operation being invoked. 31 | * For example, if a server does not support the Context.bind() method 32 | * it would throw OperationNotSupportedException when the bind() method 33 | * is invoked on it. 34 | *

35 | * Synchronization and serialization issues that apply to NamingException 36 | * apply directly here. 37 | * 38 | * @author Rosanna Lee 39 | * @author Scott Seligman 40 | * @since 1.3 41 | */ 42 | 43 | public class OperationNotSupportedException extends NamingException { 44 | /** 45 | * Constructs a new instance of OperationNotSupportedException. 46 | * All fields default to null. 47 | */ 48 | public OperationNotSupportedException() { 49 | super(); 50 | } 51 | 52 | /** 53 | * Constructs a new instance of OperationNotSupportedException using an 54 | * explanation. All other fields default to null. 55 | * 56 | * @param explanation Possibly null additional detail about this exception 57 | * @see java.lang.Throwable#getMessage 58 | */ 59 | public OperationNotSupportedException(String explanation) { 60 | super(explanation); 61 | } 62 | 63 | /** 64 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 65 | */ 66 | private static final long serialVersionUID = 5493232822427682064L; 67 | } 68 | -------------------------------------------------------------------------------- /java/krb/javax/naming/PartialResultException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown to indicate that the result being returned 30 | * or returned so far is partial, and that the operation cannot 31 | * be completed. For example, when listing a context, this exception 32 | * indicates that returned results only represents some of the bindings 33 | * in the context. 34 | *

35 | * Synchronization and serialization issues that apply to NamingException 36 | * apply directly here. 37 | * 38 | * @author Rosanna Lee 39 | * @author Scott Seligman 40 | * @since 1.3 41 | */ 42 | 43 | public class PartialResultException extends NamingException { 44 | /** 45 | * Constructs a new instance of the exception using the explanation 46 | * message specified. All other fields default to null. 47 | * 48 | * @param explanation Possibly null detail explaining the exception. 49 | */ 50 | public PartialResultException(String explanation) { 51 | super(explanation); 52 | } 53 | 54 | /** 55 | * Constructs a new instance of PartialResultException. 56 | * All fields default to null. 57 | */ 58 | public PartialResultException() { 59 | super(); 60 | } 61 | 62 | /** 63 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 64 | */ 65 | private static final long serialVersionUID = 2572144970049426786L; 66 | } 67 | -------------------------------------------------------------------------------- /java/krb/javax/naming/Referenceable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This interface is implemented by an object that can provide a 30 | * Reference to itself. 31 | *

32 | * A Reference represents a way of recording address information about 33 | * objects which themselves are not directly bound to the naming system. 34 | * Such objects can implement the Referenceable interface as a way 35 | * for programs that use that object to determine what its Reference is. 36 | * For example, when binding a object, if an object implements the 37 | * Referenceable interface, getReference() can be invoked on the object to 38 | * get its Reference to use for binding. 39 | * 40 | * @author Rosanna Lee 41 | * @author Scott Seligman 42 | * @author R. Vasudevan 43 | * 44 | * @see Context#bind 45 | * @see krb.javax.naming.spi.NamingManager#getObjectInstance 46 | * @see Reference 47 | * @since 1.3 48 | */ 49 | public interface Referenceable { 50 | /** 51 | * Retrieves the Reference of this object. 52 | * 53 | * @return The non-null Reference of this object. 54 | * @exception NamingException If a naming exception was encountered 55 | * while retrieving the reference. 56 | */ 57 | Reference getReference() throws NamingException; 58 | } 59 | -------------------------------------------------------------------------------- /java/krb/javax/naming/ServiceUnavailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming; 27 | 28 | /** 29 | * This exception is thrown when attempting to communicate with a 30 | * directory or naming service and that service is not available. 31 | * It might be unavailable for different reasons. For example, 32 | * the server might be too busy to service the request, or the server 33 | * might not be registered to service any requests, etc. 34 | *

35 | * Synchronization and serialization issues that apply to NamingException 36 | * apply directly here. 37 | * 38 | * @author Rosanna Lee 39 | * @author Scott Seligman 40 | * 41 | * @since 1.3 42 | */ 43 | 44 | public class ServiceUnavailableException extends NamingException { 45 | /** 46 | * Constructs a new instance of ServiceUnavailableException using an 47 | * explanation. All other fields default to null. 48 | * 49 | * @param explanation Possibly null additional detail about this exception. 50 | * @see java.lang.Throwable#getMessage 51 | */ 52 | public ServiceUnavailableException(String explanation) { 53 | super(explanation); 54 | } 55 | 56 | /** 57 | * Constructs a new instance of ServiceUnavailableException. 58 | * All fields default to null. 59 | */ 60 | public ServiceUnavailableException() { 61 | super(); 62 | } 63 | 64 | /** 65 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 66 | */ 67 | private static final long serialVersionUID = -4996964726566773444L; 68 | } 69 | -------------------------------------------------------------------------------- /java/krb/javax/naming/SizeLimitExceededException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | 27 | package krb.javax.naming; 28 | 29 | import krb.javax.naming.Name; 30 | 31 | /** 32 | * This exception is thrown when a method 33 | * produces a result that exceeds a size-related limit. 34 | * This can happen, for example, if the result contains 35 | * more objects than the user requested, or when the size 36 | * of the result exceeds some implementation-specific limit. 37 | *

38 | * Synchronization and serialization issues that apply to NamingException 39 | * apply directly here. 40 | * 41 | * @author Rosanna Lee 42 | * @author Scott Seligman 43 | * 44 | * @since 1.3 45 | */ 46 | public class SizeLimitExceededException extends LimitExceededException { 47 | /** 48 | * Constructs a new instance of SizeLimitExceededException. 49 | * All fields default to null. 50 | */ 51 | public SizeLimitExceededException() { 52 | super(); 53 | } 54 | 55 | /** 56 | * Constructs a new instance of SizeLimitExceededException using an 57 | * explanation. All other fields default to null. 58 | * 59 | * @param explanation Possibly null detail about this exception. 60 | */ 61 | public SizeLimitExceededException(String explanation) { 62 | super(explanation); 63 | } 64 | 65 | /** 66 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 67 | */ 68 | private static final long serialVersionUID = 7129289564879168579L; 69 | } 70 | -------------------------------------------------------------------------------- /java/krb/javax/naming/TimeLimitExceededException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | 27 | package krb.javax.naming; 28 | 29 | import krb.javax.naming.Name; 30 | 31 | /** 32 | * This exception is thrown when a method 33 | * does not terminate within the specified time limit. 34 | * This can happen, for example, if the user specifies that 35 | * the method should take no longer than 10 seconds, and the 36 | * method fails to complete with 10 seconds. 37 | * 38 | *

Synchronization and serialization issues that apply to NamingException 39 | * apply directly here. 40 | * 41 | * @author Rosanna Lee 42 | * @author Scott Seligman 43 | * 44 | * @since 1.3 45 | */ 46 | public class TimeLimitExceededException extends LimitExceededException { 47 | /** 48 | * Constructs a new instance of TimeLimitExceededException. 49 | * All fields default to null. 50 | */ 51 | public TimeLimitExceededException() { 52 | super(); 53 | } 54 | 55 | /** 56 | * Constructs a new instance of TimeLimitExceededException 57 | * using the argument supplied. 58 | * @param explanation possibly null detail about this exception. 59 | * @see java.lang.Throwable#getMessage 60 | */ 61 | public TimeLimitExceededException(String explanation) { 62 | super(explanation); 63 | } 64 | 65 | /** 66 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 67 | */ 68 | private static final long serialVersionUID = -3597009011385034696L; 69 | } 70 | -------------------------------------------------------------------------------- /java/krb/javax/naming/directory/AttributeInUseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming.directory; 27 | 28 | import krb.javax.naming.NamingException; 29 | 30 | /** 31 | * This exception is thrown when an operation attempts 32 | * to add an attribute that already exists. 33 | *

34 | * Synchronization and serialization issues that apply to NamingException 35 | * apply directly here. 36 | * 37 | * @author Rosanna Lee 38 | * @author Scott Seligman 39 | * 40 | * @see DirContext#modifyAttributes 41 | * @since 1.3 42 | */ 43 | public class AttributeInUseException extends NamingException { 44 | /** 45 | * Constructs a new instance of AttributeInUseException with 46 | * an explanation. All other fields are set to null. 47 | * 48 | * @param explanation Possibly null additional detail about this exception. 49 | * @see java.lang.Throwable#getMessage 50 | */ 51 | public AttributeInUseException(String explanation) { 52 | super(explanation); 53 | } 54 | 55 | /** 56 | * Constructs a new instance of AttributeInUseException. 57 | * All fields are initialized to null. 58 | */ 59 | public AttributeInUseException() { 60 | super(); 61 | } 62 | 63 | /** 64 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 65 | */ 66 | private static final long serialVersionUID = 4437710305529322564L; 67 | } 68 | -------------------------------------------------------------------------------- /java/krb/javax/naming/directory/InvalidAttributeIdentifierException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming.directory; 27 | 28 | import krb.javax.naming.NamingException; 29 | 30 | /** 31 | * This exception is thrown when an attempt is 32 | * made to add to create an attribute with an invalid attribute identifier. 33 | * The validity of an attribute identifier is directory-specific. 34 | *

35 | * Synchronization and serialization issues that apply to NamingException 36 | * apply directly here. 37 | * 38 | * @author Rosanna Lee 39 | * @author Scott Seligman 40 | * @since 1.3 41 | */ 42 | 43 | public class InvalidAttributeIdentifierException extends NamingException { 44 | /** 45 | * Constructs a new instance of InvalidAttributeIdentifierException using the 46 | * explanation supplied. All other fields set to null. 47 | * @param explanation Possibly null string containing additional detail about this exception. 48 | * @see java.lang.Throwable#getMessage 49 | */ 50 | public InvalidAttributeIdentifierException(String explanation) { 51 | super(explanation); 52 | } 53 | 54 | /** 55 | * Constructs a new instance of InvalidAttributeIdentifierException. 56 | * All fields are set to null. 57 | */ 58 | public InvalidAttributeIdentifierException() { 59 | super(); 60 | } 61 | 62 | /** 63 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 64 | */ 65 | private static final long serialVersionUID = -9036920266322999923L; 66 | } 67 | -------------------------------------------------------------------------------- /java/krb/javax/naming/directory/InvalidAttributeValueException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming.directory; 27 | 28 | import krb.javax.naming.NamingException; 29 | 30 | /** 31 | * This class is thrown when an attempt is 32 | * made to add to an attribute a value that conflicts with the attribute's 33 | * schema definition. This could happen, for example, if attempting 34 | * to add an attribute with no value when the attribute is required 35 | * to have at least one value, or if attempting to add more than 36 | * one value to a single valued-attribute, or if attempting to 37 | * add a value that conflicts with the syntax of the attribute. 38 | *

39 | * Synchronization and serialization issues that apply to NamingException 40 | * apply directly here. 41 | * 42 | * @author Rosanna Lee 43 | * @author Scott Seligman 44 | * @since 1.3 45 | */ 46 | 47 | public class InvalidAttributeValueException extends NamingException { 48 | /** 49 | * Constructs a new instance of InvalidAttributeValueException using 50 | * an explanation. All other fields are set to null. 51 | * @param explanation Additional detail about this exception. Can be null. 52 | * @see java.lang.Throwable#getMessage 53 | */ 54 | public InvalidAttributeValueException(String explanation) { 55 | super(explanation); 56 | } 57 | 58 | /** 59 | * Constructs a new instance of InvalidAttributeValueException. 60 | * All fields are set to null. 61 | */ 62 | public InvalidAttributeValueException() { 63 | super(); 64 | } 65 | 66 | /** 67 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 68 | */ 69 | private static final long serialVersionUID = 8720050295499275011L; 70 | } 71 | -------------------------------------------------------------------------------- /java/krb/javax/naming/directory/InvalidAttributesException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming.directory; 27 | 28 | import krb.javax.naming.NamingException; 29 | 30 | /** 31 | * This exception is thrown when an attempt is 32 | * made to add or modify an attribute set that has been specified 33 | * incompletely or incorrectly. This could happen, for example, 34 | * when attempting to add or modify a binding, or to create a new 35 | * subcontext without specifying all the mandatory attributes 36 | * required for creation of the object. Another situation in 37 | * which this exception is thrown is by specification of incompatible 38 | * attributes within the same attribute set, or attributes in conflict 39 | * with that specified by the object's schema. 40 | *

41 | * Synchronization and serialization issues that apply to NamingException 42 | * apply directly here. 43 | * 44 | * @author Rosanna Lee 45 | * @author Scott Seligman 46 | * @since 1.3 47 | */ 48 | 49 | public class InvalidAttributesException extends NamingException { 50 | /** 51 | * Constructs a new instance of InvalidAttributesException using an 52 | * explanation. All other fields are set to null. 53 | * @param explanation Additional detail about this exception. Can be null. 54 | * @see java.lang.Throwable#getMessage 55 | */ 56 | public InvalidAttributesException(String explanation) { 57 | super(explanation); 58 | } 59 | 60 | /** 61 | * Constructs a new instance of InvalidAttributesException. 62 | * All fields are set to null. 63 | */ 64 | public InvalidAttributesException() { 65 | super(); 66 | } 67 | 68 | /** 69 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 70 | */ 71 | private static final long serialVersionUID = 2607612850539889765L; 72 | } 73 | -------------------------------------------------------------------------------- /java/krb/javax/naming/directory/InvalidSearchControlsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | 27 | package krb.javax.naming.directory; 28 | 29 | import krb.javax.naming.NamingException; 30 | 31 | /** 32 | * This exception is thrown when the specification of 33 | * the SearchControls for a search operation is invalid. For example, if the scope is 34 | * set to a value other than OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE, 35 | * this exception is thrown. 36 | *

37 | * Synchronization and serialization issues that apply to NamingException 38 | * apply directly here. 39 | * 40 | * @author Rosanna Lee 41 | * @author Scott Seligman 42 | * @since 1.3 43 | */ 44 | public class InvalidSearchControlsException extends NamingException { 45 | /** 46 | * Constructs a new instance of InvalidSearchControlsException. 47 | * All fields are set to null. 48 | */ 49 | public InvalidSearchControlsException() { 50 | super(); 51 | } 52 | 53 | /** 54 | * Constructs a new instance of InvalidSearchControlsException 55 | * with an explanation. All other fields set to null. 56 | * @param msg Detail about this exception. Can be null. 57 | * @see java.lang.Throwable#getMessage 58 | */ 59 | public InvalidSearchControlsException(String msg) { 60 | super(msg); 61 | } 62 | 63 | /** 64 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 65 | */ 66 | private static final long serialVersionUID = -5124108943352665777L; 67 | } 68 | -------------------------------------------------------------------------------- /java/krb/javax/naming/directory/InvalidSearchFilterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | 27 | package krb.javax.naming.directory; 28 | 29 | import krb.javax.naming.NamingException; 30 | 31 | /** 32 | * This exception is thrown when the specification of 33 | * a search filter is invalid. The expression of the filter may 34 | * be invalid, or there may be a problem with one of the parameters 35 | * passed to the filter. 36 | *

37 | * Synchronization and serialization issues that apply to NamingException 38 | * apply directly here. 39 | * 40 | * @author Rosanna Lee 41 | * @author Scott Seligman 42 | * @since 1.3 43 | */ 44 | public class InvalidSearchFilterException extends NamingException { 45 | /** 46 | * Constructs a new instance of InvalidSearchFilterException. 47 | * All fields are set to null. 48 | */ 49 | public InvalidSearchFilterException() { 50 | super(); 51 | } 52 | 53 | /** 54 | * Constructs a new instance of InvalidSearchFilterException 55 | * with an explanation. All other fields are set to null. 56 | * @param msg Detail about this exception. Can be null. 57 | * @see java.lang.Throwable#getMessage 58 | */ 59 | public InvalidSearchFilterException(String msg) { 60 | super(msg); 61 | } 62 | 63 | /** 64 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 65 | */ 66 | private static final long serialVersionUID = 2902700940682875441L; 67 | } 68 | -------------------------------------------------------------------------------- /java/krb/javax/naming/directory/NoSuchAttributeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming.directory; 27 | 28 | import krb.javax.naming.NamingException; 29 | 30 | /** 31 | * This exception is thrown when attempting to access 32 | * an attribute that does not exist. 33 | *

34 | * Synchronization and serialization issues that apply to NamingException 35 | * apply directly here. 36 | * 37 | * @author Rosanna Lee 38 | * @author Scott Seligman 39 | * @since 1.3 40 | */ 41 | 42 | public class NoSuchAttributeException extends NamingException { 43 | /** 44 | * Constructs a new instance of NoSuchAttributeException using 45 | * an explanation. All other fields are set to null. 46 | * @param explanation Additional detail about this exception. Can be null. 47 | * @see java.lang.Throwable#getMessage 48 | */ 49 | public NoSuchAttributeException(String explanation) { 50 | super(explanation); 51 | } 52 | 53 | 54 | /** 55 | * Constructs a new instance of NoSuchAttributeException. 56 | * All fields are initialized to null. 57 | */ 58 | public NoSuchAttributeException() { 59 | super(); 60 | } 61 | 62 | /** 63 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 64 | */ 65 | private static final long serialVersionUID = 4836415647935888137L; 66 | } 67 | -------------------------------------------------------------------------------- /java/krb/javax/naming/directory/SchemaViolationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | 27 | package krb.javax.naming.directory; 28 | 29 | import krb.javax.naming.NamingException; 30 | 31 | /** 32 | * This exception is thrown when a method 33 | * in some ways violates the schema. An example of schema violation 34 | * is modifying attributes of an object that violates the object's 35 | * schema definition. Another example is renaming or moving an object 36 | * to a part of the namespace that violates the namespace's 37 | * schema definition. 38 | *

39 | * Synchronization and serialization issues that apply to NamingException 40 | * apply directly here. 41 | * 42 | * @author Rosanna Lee 43 | * @author Scott Seligman 44 | * 45 | * @see krb.javax.naming.Context#bind 46 | * @see DirContext#bind 47 | * @see krb.javax.naming.Context#rebind 48 | * @see DirContext#rebind 49 | * @see DirContext#createSubcontext 50 | * @see krb.javax.naming.Context#createSubcontext 51 | * @see DirContext#modifyAttributes 52 | * @since 1.3 53 | */ 54 | public class SchemaViolationException extends NamingException { 55 | /** 56 | * Constructs a new instance of SchemaViolationException. 57 | * All fields are set to null. 58 | */ 59 | public SchemaViolationException() { 60 | super(); 61 | } 62 | 63 | /** 64 | * Constructs a new instance of SchemaViolationException 65 | * using the explanation supplied. All other fields are set to null. 66 | * @param explanation Detail about this exception. Can be null. 67 | * @see java.lang.Throwable#getMessage 68 | */ 69 | public SchemaViolationException(String explanation) { 70 | super(explanation); 71 | } 72 | 73 | /** 74 | * Use serialVersionUID from JNDI 1.1.1 for interoperability 75 | */ 76 | private static final long serialVersionUID = -3041762429525049663L; 77 | } 78 | -------------------------------------------------------------------------------- /java/krb/javax/naming/spi/InitialContextFactoryBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.naming.spi; 27 | 28 | import java.util.Hashtable; 29 | import krb.javax.naming.NamingException; 30 | 31 | /** 32 | * This interface represents a builder that creates initial context factories. 33 | *

34 | * The JNDI framework allows for different initial context implementations 35 | * to be specified at runtime. An initial context is created using 36 | * an initial context factory. A program can install its own builder 37 | * that creates initial context factories, thereby overriding the 38 | * default policies used by the framework, by calling 39 | * NamingManager.setInitialContextFactoryBuilder(). 40 | * The InitialContextFactoryBuilder interface must be implemented by 41 | * such a builder. 42 | * 43 | * @author Rosanna Lee 44 | * @author Scott Seligman 45 | * 46 | * @see InitialContextFactory 47 | * @see NamingManager#getInitialContext 48 | * @see NamingManager#setInitialContextFactoryBuilder 49 | * @see NamingManager#hasInitialContextFactoryBuilder 50 | * @see krb.javax.naming.InitialContext 51 | * @see krb.javax.naming.directory.InitialDirContext 52 | * @since 1.3 53 | */ 54 | public interface InitialContextFactoryBuilder { 55 | /** 56 | * Creates an initial context factory using the specified 57 | * environment. 58 | *

59 | * The environment parameter is owned by the caller. 60 | * The implementation will not modify the object or keep a reference 61 | * to it, although it may keep a reference to a clone or copy. 62 | * 63 | * @param environment Environment used in creating an initial 64 | * context implementation. Can be null. 65 | * @return A non-null initial context factory. 66 | * @exception NamingException If an initial context factory could not be created. 67 | */ 68 | public InitialContextFactory 69 | createInitialContextFactory(Hashtable environment) 70 | throws NamingException; 71 | } 72 | -------------------------------------------------------------------------------- /java/krb/javax/security/auth/RefreshFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.security.auth; 27 | 28 | /** 29 | * Signals that a {@code refresh} operation failed. 30 | * 31 | *

This exception is thrown by credentials implementing 32 | * the {@code Refreshable} interface when the {@code refresh} 33 | * method fails. 34 | * 35 | */ 36 | public class RefreshFailedException extends Exception { 37 | 38 | private static final long serialVersionUID = 5058444488565265840L; 39 | 40 | /** 41 | * Constructs a RefreshFailedException with no detail message. A detail 42 | * message is a String that describes this particular exception. 43 | */ 44 | public RefreshFailedException() { 45 | super(); 46 | } 47 | 48 | /** 49 | * Constructs a RefreshFailedException with the specified detail 50 | * message. A detail message is a String that describes this particular 51 | * exception. 52 | * 53 | *

54 | * 55 | * @param msg the detail message. 56 | */ 57 | public RefreshFailedException(String msg) { 58 | super(msg); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /java/krb/javax/security/auth/Refreshable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.security.auth; 27 | 28 | /** 29 | * Objects such as credentials may optionally implement this 30 | * interface to provide the capability to refresh itself. 31 | * For example, a credential with a particular time-restricted lifespan 32 | * may implement this interface to allow callers to refresh the time period 33 | * for which it is valid. 34 | * 35 | * @see javax.security.auth.Subject 36 | */ 37 | public interface Refreshable { 38 | 39 | /** 40 | * Determine if this {@code Object} is current. 41 | * 42 | *

43 | * 44 | * @return true if this {@code Object} is currently current, 45 | * false otherwise. 46 | */ 47 | boolean isCurrent(); 48 | 49 | /** 50 | * Update or extend the validity period for this 51 | * {@code Object}. 52 | * 53 | *

54 | * 55 | * @exception SecurityException if the caller does not have permission 56 | * to update or extend the validity period for this 57 | * {@code Object}.

58 | * 59 | * @exception RefreshFailedException if the refresh attempt failed. 60 | */ 61 | void refresh() throws RefreshFailedException; 62 | } 63 | -------------------------------------------------------------------------------- /java/krb/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package krb.javax.security.auth.kerberos; 27 | 28 | import sun.security.krb5.JavaxSecurityAuthKerberosAccess; 29 | import sun.security.krb5.EncryptionKey; 30 | import sun.security.krb5.PrincipalName; 31 | 32 | class JavaxSecurityAuthKerberosAccessImpl 33 | implements JavaxSecurityAuthKerberosAccess { 34 | public sun.security.krb5.internal.ktab.KeyTab keyTabTakeSnapshot( 35 | KeyTab ktab) { 36 | return ktab.takeSnapshot(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /java/sun/security/action/GetBooleanAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.action; 27 | 28 | /** 29 | * A convenience class for retrieving the boolean value of a system property 30 | * as a privileged action. 31 | * 32 | *

An instance of this class can be used as the argument of 33 | * AccessController.doPrivileged. 34 | * 35 | *

The following code retrieves the boolean value of the system 36 | * property named "prop" as a privileged action:

37 | * 38 | *

39 |  * boolean b = java.security.AccessController.doPrivileged
40 |  *              (new GetBooleanAction("prop")).booleanValue();
41 |  * 
42 | * 43 | * @author Roland Schemers 44 | * @see java.security.PrivilegedAction 45 | * @see java.security.AccessController 46 | * @since 1.2 47 | */ 48 | 49 | public class GetBooleanAction 50 | implements java.security.PrivilegedAction { 51 | private String theProp; 52 | 53 | /** 54 | * Constructor that takes the name of the system property whose boolean 55 | * value needs to be determined. 56 | * 57 | * @param theProp the name of the system property. 58 | */ 59 | public GetBooleanAction(String theProp) { 60 | this.theProp = theProp; 61 | } 62 | 63 | /** 64 | * Determines the boolean value of the system property whose name was 65 | * specified in the constructor. 66 | * 67 | * @return the Boolean value of the system property. 68 | */ 69 | public Boolean run() { 70 | return Boolean.getBoolean(theProp); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /java/sun/security/action/GetBooleanSecurityPropertyAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.action; 27 | 28 | import java.security.Security; 29 | 30 | /** 31 | * A convenience class for retrieving the boolean value of a security property 32 | * as a privileged action. 33 | * 34 | *

An instance of this class can be used as the argument of 35 | * AccessController.doPrivileged. 36 | * 37 | *

The following code retrieves the boolean value of the security 38 | * property named "prop" as a privileged action:

39 | * 40 | *

41 |  * boolean b = java.security.AccessController.doPrivileged
42 |  *              (new GetBooleanSecurityPropertyAction("prop")).booleanValue();
43 |  * 
44 | * 45 | */ 46 | public class GetBooleanSecurityPropertyAction 47 | implements java.security.PrivilegedAction { 48 | private String theProp; 49 | 50 | /** 51 | * Constructor that takes the name of the security property whose boolean 52 | * value needs to be determined. 53 | * 54 | * @param theProp the name of the security property 55 | */ 56 | public GetBooleanSecurityPropertyAction(String theProp) { 57 | this.theProp = theProp; 58 | } 59 | 60 | /** 61 | * Determines the boolean value of the security property whose name was 62 | * specified in the constructor. 63 | * 64 | * @return the Boolean value of the security property. 65 | */ 66 | public Boolean run() { 67 | boolean b = false; 68 | try { 69 | String value = Security.getProperty(theProp); 70 | b = (value != null) && value.equalsIgnoreCase("true"); 71 | } catch (NullPointerException e) {} 72 | return b; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /java/sun/security/action/OpenFileInputStreamAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.action; 27 | 28 | import java.io.*; 29 | 30 | import java.security.PrivilegedExceptionAction; 31 | 32 | /** 33 | * A convenience class for opening a FileInputStream as a privileged action. 34 | * 35 | * @author Andreas Sterbenz 36 | */ 37 | public class OpenFileInputStreamAction 38 | implements PrivilegedExceptionAction { 39 | 40 | private final File file; 41 | 42 | public OpenFileInputStreamAction(File file) { 43 | this.file = file; 44 | } 45 | 46 | public OpenFileInputStreamAction(String filename) { 47 | this.file = new File(filename); 48 | } 49 | 50 | public FileInputStream run() throws Exception { 51 | return new FileInputStream(file); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /java/sun/security/action/PutAllAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.action; 27 | 28 | import java.util.Map; 29 | 30 | import java.security.Provider; 31 | import java.security.PrivilegedAction; 32 | 33 | /** 34 | * A convenience PrivilegedAction class for setting the properties of 35 | * a provider. See the SunRsaSign provider for a usage example. 36 | * 37 | * @see sun.security.rsa.SunRsaSign 38 | * @author Andreas Sterbenz 39 | * @since 1.5 40 | */ 41 | public class PutAllAction implements PrivilegedAction { 42 | 43 | private final Provider provider; 44 | private final Map map; 45 | 46 | public PutAllAction(Provider provider, Map map) { 47 | this.provider = provider; 48 | this.map = map; 49 | } 50 | 51 | public Void run() { 52 | provider.putAll(map); 53 | return null; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /java/sun/security/jca/ServiceId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.jca; 27 | 28 | /** 29 | * Simple class encapsulating a service type and algorithm for lookup. 30 | * Put in a separate file rather than nested to allow import via ...jca.*. 31 | * 32 | * @author Andreas Sterbenz 33 | * @since 1.5 34 | */ 35 | public final class ServiceId { 36 | 37 | public final String type; 38 | public final String algorithm; 39 | 40 | public ServiceId(String type, String algorithm) { 41 | this.type = type; 42 | this.algorithm = algorithm; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /java/sun/security/jgss/GSSCaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.jgss; 27 | 28 | /** 29 | * Denotes what client is calling the JGSS-API. The object can be sent deep 30 | * into the mechanism level so that special actions can be performed for 31 | * different callers. 32 | */ 33 | public class GSSCaller { 34 | public static final GSSCaller CALLER_UNKNOWN = new GSSCaller("UNKNOWN"); 35 | public static final GSSCaller CALLER_INITIATE = new GSSCaller("INITIATE"); 36 | public static final GSSCaller CALLER_ACCEPT = new GSSCaller("ACCEPT"); 37 | public static final GSSCaller CALLER_SSL_CLIENT = new GSSCaller("SSL_CLIENT"); 38 | public static final GSSCaller CALLER_SSL_SERVER = new GSSCaller("SSL_SERVER"); 39 | 40 | private String name; 41 | GSSCaller(String s) { 42 | name = s; 43 | } 44 | @Override 45 | public String toString() { 46 | return "GSSCaller{" + name + '}'; 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /java/sun/security/jgss/HttpCaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.jgss; 27 | 28 | import sun.net.www.protocol.http.HttpCallerInfo; 29 | 30 | /** 31 | * A special kind of GSSCaller, which origins from HTTP/Negotiate and contains 32 | * info about what triggers the JGSS calls. 33 | */ 34 | public class HttpCaller extends GSSCaller { 35 | final private HttpCallerInfo hci; 36 | 37 | public HttpCaller(HttpCallerInfo hci) { 38 | super("HTTP_CLIENT"); 39 | this.hci = hci; 40 | } 41 | 42 | public HttpCallerInfo info() { 43 | return hci; 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /java/sun/security/jgss/SunProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.jgss; 27 | 28 | import java.security.Provider; 29 | import java.security.AccessController; 30 | 31 | /** 32 | * Defines the Sun JGSS provider. 33 | * Will merger this with the Sun security provider 34 | * sun.security.provider.Sun when the JGSS src is merged with the JDK 35 | * src. 36 | * 37 | * Mechanisms supported are: 38 | * 39 | * - Kerberos v5 as defined in RFC 1964. 40 | * Oid is 1.2.840.113554.1.2.2 41 | * 42 | * - SPNEGO as defined in RFC 2478 43 | * Oid is 1.3.6.1.5.5.2 44 | * 45 | * [Dummy mechanism is no longer compiled: 46 | * - Dummy mechanism. This is primarily useful to test a multi-mech 47 | * environment. 48 | * Oid is 1.3.6.1.4.1.42.2.26.1.2] 49 | * 50 | * @author Mayank Upadhyay 51 | */ 52 | 53 | public final class SunProvider extends Provider { 54 | 55 | private static final long serialVersionUID = -238911724858694198L; 56 | 57 | private static final String INFO = "Sun " + 58 | "(Kerberos v5, SPNEGO)"; 59 | // "(Kerberos v5, Dummy GSS-API Mechanism)"; 60 | 61 | public static final SunProvider INSTANCE = new SunProvider(); 62 | 63 | public SunProvider() { 64 | /* We are the Sun JGSS provider */ 65 | super("SunJGSS", 1.8d, INFO); 66 | 67 | AccessController.doPrivileged( 68 | new java.security.PrivilegedAction() { 69 | public Void run() { 70 | put("GssApiMechanism.1.2.840.113554.1.2.2", 71 | "sun.security.jgss.krb5.Krb5MechFactory"); 72 | put("GssApiMechanism.1.3.6.1.5.5.2", 73 | "sun.security.jgss.spnego.SpNegoMechFactory"); 74 | /* 75 | put("GssApiMechanism.1.3.6.1.4.1.42.2.26.1.2", 76 | "sun.security.jgss.dummy.DummyMechFactory"); 77 | */ 78 | return null; 79 | } 80 | }); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /java/sun/security/jgss/krb5/Krb5CredElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.jgss.krb5; 27 | 28 | import org.ietf.jgss.*; 29 | import sun.security.jgss.spi.*; 30 | import sun.security.krb5.*; 31 | import java.security.Provider; 32 | 33 | /** 34 | * Provides type safety for Krb5 credential elements. 35 | * 36 | * @author Mayank Upadhyay 37 | * @since 1.4 38 | */ 39 | interface Krb5CredElement 40 | extends GSSCredentialSpi { 41 | } 42 | -------------------------------------------------------------------------------- /java/sun/security/jgss/wrapper/Krb5Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | package sun.security.jgss.wrapper; 26 | 27 | import org.ietf.jgss.*; 28 | import krb.javax.security.auth.kerberos.ServicePermission; 29 | 30 | /** 31 | * This class is an utility class for Kerberos related stuff. 32 | * @author Valerie Peng 33 | * @since 1.6 34 | */ 35 | class Krb5Util { 36 | 37 | // Return the Kerberos TGS principal name using the domain 38 | // of the specified name 39 | static String getTGSName(GSSNameElement name) 40 | throws GSSException { 41 | String krbPrinc = name.getKrbName(); 42 | int atIndex = krbPrinc.indexOf("@"); 43 | String realm = krbPrinc.substring(atIndex + 1); 44 | StringBuffer buf = new StringBuffer("krbtgt/"); 45 | buf.append(realm).append('@').append(realm); 46 | return buf.toString(); 47 | } 48 | 49 | // Perform the Service Permission check using the specified 50 | // target and action 51 | static void checkServicePermission(String target, String action) { 52 | SecurityManager sm = System.getSecurityManager(); 53 | if (sm != null) { 54 | SunNativeProvider.debug("Checking ServicePermission(" + 55 | target + ", " + action + ")"); 56 | ServicePermission perm = 57 | new ServicePermission(target, action); 58 | sm.checkPermission(perm); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /java/sun/security/krb5/Asn1Exception.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5; 32 | 33 | public class Asn1Exception extends KrbException { 34 | 35 | private static final long serialVersionUID = 8291288984575084132L; 36 | 37 | public Asn1Exception(int i) { 38 | super(i); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /java/sun/security/krb5/Confounder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | /* 27 | * 28 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 29 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 30 | */ 31 | 32 | package sun.security.krb5; 33 | 34 | import java.security.SecureRandom; 35 | 36 | public final class Confounder { 37 | private static SecureRandom srand = new SecureRandom(); 38 | 39 | private Confounder() { // not instantiable 40 | } 41 | 42 | public static byte[] bytes(int size) { 43 | byte[] data = new byte[size]; 44 | srand.nextBytes(data); 45 | return data; 46 | } 47 | 48 | public static int intValue() { 49 | return srand.nextInt(); 50 | } 51 | 52 | public static long longValue() { 53 | return srand.nextLong(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /java/sun/security/krb5/JavaxSecurityAuthKerberosAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.krb5; 27 | 28 | import krb.javax.security.auth.kerberos.KeyTab; 29 | import sun.security.krb5.EncryptionKey; 30 | import sun.security.krb5.PrincipalName; 31 | 32 | /** 33 | * An unsafe tunnel to get non-public access to classes in the 34 | * krb.javax.security.auth.kerberos package. 35 | */ 36 | public interface JavaxSecurityAuthKerberosAccess { 37 | /** 38 | * Returns a snapshot to the backing keytab 39 | */ 40 | public sun.security.krb5.internal.ktab.KeyTab keyTabTakeSnapshot( 41 | KeyTab ktab); 42 | } 43 | -------------------------------------------------------------------------------- /java/sun/security/krb5/KerberosSecrets.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.krb5; 27 | 28 | public class KerberosSecrets { 29 | private static JavaxSecurityAuthKerberosAccess javaxSecurityAuthKerberosAccess; 30 | 31 | public static void setJavaxSecurityAuthKerberosAccess 32 | (JavaxSecurityAuthKerberosAccess jsaka) { 33 | javaxSecurityAuthKerberosAccess = jsaka; 34 | } 35 | 36 | public static JavaxSecurityAuthKerberosAccess 37 | getJavaxSecurityAuthKerberosAccess() { 38 | return javaxSecurityAuthKerberosAccess; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /java/sun/security/krb5/KrbCryptoException.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5; 32 | 33 | /** 34 | * KrbCryptoExceptoin is a wrapper exception for exceptions thrown by JCE. 35 | * 36 | * @author Yanni Zhang 37 | */ 38 | public class KrbCryptoException extends KrbException { 39 | 40 | private static final long serialVersionUID = -1657367919979982250L; 41 | 42 | public KrbCryptoException (String s) { 43 | super(s); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java/sun/security/krb5/RealmException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | /* 27 | * 28 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 29 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 30 | */ 31 | 32 | package sun.security.krb5; 33 | 34 | public class RealmException extends KrbException { 35 | 36 | private static final long serialVersionUID = -9100385213693792864L; 37 | 38 | public RealmException(int i) { 39 | super(i); 40 | } 41 | 42 | public RealmException(String s) { 43 | super(s); 44 | } 45 | 46 | public RealmException(int i, String s) { 47 | super(i,s); 48 | } 49 | 50 | public RealmException(Throwable cause) { 51 | super(cause); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/ASRep.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal; 32 | 33 | import sun.security.krb5.PrincipalName; 34 | import sun.security.krb5.EncryptedData; 35 | import sun.security.krb5.Asn1Exception; 36 | import sun.security.krb5.Realm; 37 | import sun.security.krb5.RealmException; 38 | import sun.security.util.*; 39 | import java.io.IOException; 40 | 41 | public class ASRep extends KDCRep { 42 | 43 | public ASRep( 44 | PAData[] new_pAData, 45 | PrincipalName new_cname, 46 | Ticket new_ticket, 47 | EncryptedData new_encPart) throws IOException { 48 | super(new_pAData, new_cname, new_ticket, 49 | new_encPart, Krb5.KRB_AS_REP); 50 | } 51 | 52 | public ASRep(byte[] data) throws Asn1Exception, 53 | RealmException, KrbApErrException, IOException { 54 | init(new DerValue(data)); 55 | } 56 | 57 | public ASRep(DerValue encoding) throws Asn1Exception, 58 | RealmException, KrbApErrException, IOException { 59 | init(encoding); 60 | } 61 | 62 | private void init(DerValue encoding) throws Asn1Exception, 63 | RealmException, KrbApErrException, IOException { 64 | init(encoding, Krb5.KRB_AS_REP); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/ASReq.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal; 32 | 33 | import sun.security.krb5.*; 34 | import sun.security.util.*; 35 | import java.io.IOException; 36 | 37 | public class ASReq extends KDCReq { 38 | 39 | public ASReq(PAData[] new_pAData, KDCReqBody new_reqBody) throws IOException { 40 | super(new_pAData, new_reqBody, Krb5.KRB_AS_REQ); 41 | } 42 | 43 | public ASReq(byte[] data) throws Asn1Exception, KrbException, IOException { 44 | init(new DerValue(data)); 45 | } 46 | 47 | public ASReq(DerValue encoding) throws Asn1Exception, KrbException, IOException { 48 | init(encoding); 49 | } 50 | 51 | private void init(DerValue encoding) throws Asn1Exception, IOException, KrbException { 52 | super.init(encoding, Krb5.KRB_AS_REQ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/AuthContext.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal; 32 | 33 | import sun.security.krb5.EncryptionKey; 34 | import java.util.BitSet; 35 | 36 | public class AuthContext { 37 | public HostAddress remoteAddress; 38 | public int remotePort; 39 | public HostAddress localAddress; 40 | public int localPort; 41 | public EncryptionKey keyBlock; 42 | public EncryptionKey localSubkey; 43 | public EncryptionKey remoteSubkey; 44 | public BitSet authContextFlags; 45 | public int remoteSeqNumber; 46 | public int localSeqNumber; 47 | public Authenticator authenticator; 48 | public int reqCksumType; 49 | public int safeCksumType; 50 | public byte[] initializationVector; 51 | //public ReplayCache replayCache; 52 | }; 53 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/EncASRepPart.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal; 32 | 33 | import sun.security.krb5.*; 34 | import sun.security.util.*; 35 | import java.io.IOException; 36 | 37 | public class EncASRepPart extends EncKDCRepPart { 38 | 39 | public EncASRepPart( 40 | EncryptionKey new_key, 41 | LastReq new_lastReq, 42 | int new_nonce, 43 | KerberosTime new_keyExpiration, 44 | TicketFlags new_flags, 45 | KerberosTime new_authtime, 46 | KerberosTime new_starttime, 47 | KerberosTime new_endtime, 48 | KerberosTime new_renewTill, 49 | PrincipalName new_sname, 50 | HostAddresses new_caddr) { 51 | super( 52 | new_key, 53 | new_lastReq, 54 | new_nonce, 55 | new_keyExpiration, 56 | new_flags, 57 | new_authtime, 58 | new_starttime, 59 | new_endtime, 60 | new_renewTill, 61 | new_sname, 62 | new_caddr, 63 | Krb5.KRB_ENC_AS_REP_PART 64 | ); 65 | //may need to use Krb5.KRB_ENC_TGS_REP_PART to mimic 66 | //behavior of other implementaions, instead of above 67 | } 68 | 69 | public EncASRepPart(byte[] data) throws Asn1Exception, 70 | IOException, KrbException { 71 | init(new DerValue(data)); 72 | } 73 | 74 | public EncASRepPart(DerValue encoding) throws Asn1Exception, 75 | IOException, KrbException { 76 | init(encoding); 77 | } 78 | 79 | private void init(DerValue encoding) throws Asn1Exception, 80 | IOException, KrbException { 81 | init(encoding, Krb5.KRB_ENC_AS_REP_PART); 82 | } 83 | 84 | public byte[] asn1Encode() throws Asn1Exception, 85 | IOException { 86 | return asn1Encode(Krb5.KRB_ENC_AS_REP_PART); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/EncTGSRepPart.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 27 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 28 | */ 29 | 30 | package sun.security.krb5.internal; 31 | 32 | import sun.security.krb5.*; 33 | import sun.security.util.*; 34 | import java.io.IOException; 35 | 36 | public class EncTGSRepPart extends EncKDCRepPart { 37 | 38 | public EncTGSRepPart( 39 | EncryptionKey new_key, 40 | LastReq new_lastReq, 41 | int new_nonce, 42 | KerberosTime new_keyExpiration, 43 | TicketFlags new_flags, 44 | KerberosTime new_authtime, 45 | KerberosTime new_starttime, 46 | KerberosTime new_endtime, 47 | KerberosTime new_renewTill, 48 | PrincipalName new_sname, 49 | HostAddresses new_caddr) { 50 | super( 51 | new_key, 52 | new_lastReq, 53 | new_nonce, 54 | new_keyExpiration, 55 | new_flags, 56 | new_authtime, 57 | new_starttime, 58 | new_endtime, 59 | new_renewTill, 60 | new_sname, 61 | new_caddr, 62 | Krb5.KRB_ENC_TGS_REP_PART); 63 | } 64 | 65 | public EncTGSRepPart(byte[] data) throws Asn1Exception, 66 | IOException, KrbException { 67 | init(new DerValue(data)); 68 | } 69 | 70 | public EncTGSRepPart(DerValue encoding) throws Asn1Exception, 71 | IOException, KrbException { 72 | init(encoding); 73 | } 74 | 75 | private void init(DerValue encoding) throws Asn1Exception, 76 | IOException, KrbException { 77 | init(encoding, Krb5.KRB_ENC_TGS_REP_PART); 78 | } 79 | 80 | public byte[] asn1Encode() throws Asn1Exception, 81 | IOException { 82 | return asn1Encode(Krb5.KRB_ENC_TGS_REP_PART); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/KdcErrException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | /* 27 | * 28 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 29 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 30 | */ 31 | 32 | package sun.security.krb5.internal; 33 | 34 | public class KdcErrException extends sun.security.krb5.KrbException { 35 | 36 | private static final long serialVersionUID = -8788186031117310306L; 37 | 38 | public KdcErrException(int i) { 39 | super(i); 40 | } 41 | 42 | public KdcErrException(int i, String s) { 43 | super(i, s); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/KrbApErrException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | /* 27 | * 28 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 29 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 30 | */ 31 | 32 | package sun.security.krb5.internal; 33 | 34 | public class KrbApErrException extends sun.security.krb5.KrbException { 35 | 36 | private static final long serialVersionUID = 7545264413323118315L; 37 | 38 | public KrbApErrException(int i) { 39 | super(i); 40 | } 41 | 42 | public KrbApErrException(int i, String s) { 43 | super(i, s); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/KrbErrException.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal; 32 | 33 | public class KrbErrException extends sun.security.krb5.KrbException { 34 | 35 | private static final long serialVersionUID = 2186533836785448317L; 36 | 37 | public KrbErrException(int i) { 38 | super(i); 39 | } 40 | 41 | public KrbErrException(int i, String s) { 42 | super(i, s); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/LocalSeqNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | /* 27 | * 28 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 29 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 30 | */ 31 | 32 | package sun.security.krb5.internal; 33 | 34 | import sun.security.krb5.Confounder; 35 | 36 | public class LocalSeqNumber implements SeqNumber { 37 | private int lastSeqNumber; 38 | 39 | public LocalSeqNumber() { 40 | randInit(); 41 | } 42 | 43 | public LocalSeqNumber(int start) { 44 | init(start); 45 | } 46 | 47 | public LocalSeqNumber(Integer start) { 48 | init(start.intValue()); 49 | } 50 | 51 | public synchronized void randInit() { 52 | /* 53 | * Sequence numbers fall in the range 0 through 2^32 - 1 and wrap 54 | * to zero following the value 2^32 - 1. 55 | * Previous implementations used signed sequence numbers. 56 | * Workaround implementation incompatibilities by not generating 57 | * initial sequence numbers greater than 2^30, as done 58 | * in MIT distribution. 59 | */ 60 | // get the random confounder 61 | byte[] data = Confounder.bytes(4); 62 | data[0] = (byte)(data[0] & 0x3f); 63 | int result = ((data[3] & 0xff) | 64 | ((data[2] & 0xff) << 8) | 65 | ((data[1] & 0xff) << 16) | 66 | ((data[0] & 0xff) << 24)); 67 | if (result == 0) { 68 | result = 1; 69 | } 70 | lastSeqNumber = result; 71 | } 72 | 73 | public synchronized void init(int start) { 74 | lastSeqNumber = start; 75 | } 76 | 77 | public synchronized int current() { 78 | return lastSeqNumber; 79 | } 80 | 81 | public synchronized int next() { 82 | return lastSeqNumber + 1; 83 | } 84 | 85 | public synchronized int step() { 86 | return ++lastSeqNumber; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/ReplayCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.krb5.internal; 27 | 28 | import sun.security.action.GetPropertyAction; 29 | import sun.security.krb5.internal.rcache.AuthTimeWithHash; 30 | import sun.security.krb5.internal.rcache.MemoryCache; 31 | import sun.security.krb5.internal.rcache.DflCache; 32 | 33 | import java.security.AccessController; 34 | 35 | /** 36 | * Models the replay cache of an acceptor as described in 37 | * RFC 4120 3.2.3. 38 | * @since 1.8 39 | */ 40 | public abstract class ReplayCache { 41 | public static ReplayCache getInstance(String type) { 42 | if (type == null) { 43 | return new MemoryCache(); 44 | } else if (type.equals("dfl") || type.startsWith("dfl:")) { 45 | return new DflCache(type); 46 | } else if (type.equals("none")) { 47 | return new ReplayCache() { 48 | @Override 49 | public void checkAndStore(KerberosTime currTime, AuthTimeWithHash time) 50 | throws KrbApErrException { 51 | // no check at all 52 | } 53 | }; 54 | } else { 55 | throw new IllegalArgumentException("Unknown type: " + type); 56 | } 57 | } 58 | public static ReplayCache getInstance() { 59 | String type = AccessController.doPrivileged( 60 | new GetPropertyAction("sun.security.krb5.rcache")); 61 | return getInstance(type); 62 | } 63 | 64 | /** 65 | * Accepts or rejects an AuthTime. 66 | * @param currTime the current time 67 | * @param time AuthTimeWithHash object calculated from authenticator 68 | * @throws KrbApErrException if the authenticator is a replay 69 | */ 70 | public abstract void checkAndStore(KerberosTime currTime, AuthTimeWithHash time) 71 | throws KrbApErrException; 72 | } 73 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/SeqNumber.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal; 32 | import sun.security.krb5.KrbCryptoException; 33 | 34 | public interface SeqNumber { 35 | public void randInit(); 36 | public void init(int start); 37 | public int current(); 38 | public int next(); 39 | public int step(); 40 | } 41 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/TGSRep.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal; 32 | 33 | import sun.security.krb5.PrincipalName; 34 | import sun.security.krb5.Realm; 35 | import sun.security.krb5.RealmException; 36 | import sun.security.krb5.EncryptedData; 37 | import sun.security.krb5.Asn1Exception; 38 | import sun.security.util.*; 39 | import java.io.IOException; 40 | 41 | public class TGSRep extends KDCRep { 42 | 43 | public TGSRep( 44 | PAData[] new_pAData, 45 | PrincipalName new_cname, 46 | Ticket new_ticket, 47 | EncryptedData new_encPart 48 | ) throws IOException { 49 | super(new_pAData, new_cname, new_ticket, 50 | new_encPart, Krb5.KRB_TGS_REP); 51 | } 52 | 53 | public TGSRep(byte[] data) throws Asn1Exception, 54 | RealmException, KrbApErrException, IOException { 55 | init(new DerValue(data)); 56 | } 57 | 58 | public TGSRep(DerValue encoding) throws Asn1Exception, 59 | RealmException, KrbApErrException, IOException { 60 | init(encoding); 61 | } 62 | 63 | private void init(DerValue encoding) throws Asn1Exception, 64 | RealmException, KrbApErrException, IOException { 65 | init(encoding, Krb5.KRB_TGS_REP); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/TGSReq.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal; 32 | 33 | import sun.security.krb5.*; 34 | import sun.security.util.*; 35 | import java.io.IOException; 36 | 37 | public class TGSReq extends KDCReq { 38 | 39 | public TGSReq(PAData[] new_pAData, KDCReqBody new_reqBody) throws IOException { 40 | super(new_pAData, new_reqBody, Krb5.KRB_TGS_REQ); 41 | } 42 | 43 | public TGSReq(byte[] data) throws Asn1Exception, 44 | IOException, KrbException { 45 | init(new DerValue(data)); 46 | } 47 | 48 | public TGSReq(DerValue encoding) throws Asn1Exception, 49 | IOException, KrbException { 50 | init(encoding); 51 | } 52 | 53 | private void init(DerValue encoding) throws Asn1Exception, 54 | IOException, KrbException { 55 | init(encoding, Krb5.KRB_TGS_REQ); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/ccache/FileCCacheConstants.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal.ccache; 32 | 33 | /** 34 | * Constants used by file-based credential cache classes. 35 | * 36 | * @author Yanni Zhang 37 | * 38 | */ 39 | public interface FileCCacheConstants { 40 | /* 41 | * FCC version 2 contains type information for principals. FCC 42 | * version 1 does not. 43 | * 44 | * FCC version 3 contains keyblock encryption type information, and is 45 | * architecture independent. Previous versions are not. */ 46 | public final int KRB5_FCC_FVNO_1 = 0x501; 47 | public final int KRB5_FCC_FVNO_2 = 0x502; 48 | public final int KRB5_FCC_FVNO_3 = 0x503; 49 | public final int KRB5_FCC_FVNO_4 = 0x504; 50 | public final int FCC_TAG_DELTATIME = 1; 51 | public final int KRB5_NT_UNKNOWN = 0; 52 | public final int TKT_FLG_FORWARDABLE = 0x40000000; 53 | public final int TKT_FLG_FORWARDED = 0x20000000; 54 | public final int TKT_FLG_PROXIABLE = 0x10000000; 55 | public final int TKT_FLG_PROXY = 0x08000000; 56 | public final int TKT_FLG_MAY_POSTDATE = 0x04000000; 57 | public final int TKT_FLG_POSTDATED = 0x02000000; 58 | public final int TKT_FLG_INVALID = 0x01000000; 59 | public final int TKT_FLG_RENEWABLE = 0x00800000; 60 | public final int TKT_FLG_INITIAL = 0x00400000; 61 | public final int TKT_FLG_PRE_AUTH = 0x00200000; 62 | public final int TKT_FLG_HW_AUTH = 0x00100000; 63 | } 64 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/ccache/MemoryCredentialsCache.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal.ccache; 32 | 33 | import sun.security.krb5.*; 34 | import sun.security.krb5.internal.*; 35 | import java.io.IOException; 36 | import java.io.File; 37 | 38 | //Windows supports the "API: cache" type, which is a shared memory cache. This is 39 | //implemented by krbcc32.dll as part of the MIT Kerberos for Win32 distribution. 40 | //MemoryCredentialsCache will provide future functions to access shared memeory cache on 41 | //Windows platform. Native code implementation may be necessary. 42 | /** 43 | * This class extends CredentialsCache. It is used for accessing data in shared memory 44 | * cache on Windows platforms. 45 | * 46 | * @author Yanni Zhang 47 | */ 48 | public abstract class MemoryCredentialsCache extends CredentialsCache { 49 | 50 | private static CredentialsCache getCCacheInstance(PrincipalName p) { 51 | return null; 52 | } 53 | 54 | private static CredentialsCache getCCacheInstance(PrincipalName p, File cacheFile) { 55 | return null; 56 | } 57 | 58 | 59 | public abstract boolean exists(String cache); 60 | 61 | public abstract void update(Credentials c); 62 | 63 | public abstract void save() throws IOException, KrbException; 64 | 65 | public abstract Credentials[] getCredsList(); 66 | 67 | public abstract Credentials getCreds(PrincipalName sname) ; 68 | 69 | public abstract PrincipalName getPrimaryPrincipal(); 70 | 71 | } 72 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/ccache/Tag.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal.ccache; 32 | 33 | import sun.security.krb5.*; 34 | import java.io.ByteArrayOutputStream; 35 | 36 | /** 37 | * tag field introduced in KRB5_FCC_FVNO_4 38 | * 39 | * @author Yanni Zhang 40 | */ 41 | public class Tag{ 42 | int length; 43 | int tag; 44 | int tagLen; 45 | Integer time_offset; 46 | Integer usec_offset; 47 | 48 | public Tag(int len, int new_tag, Integer new_time, Integer new_usec) { 49 | tag = new_tag; 50 | tagLen = 8; 51 | time_offset = new_time; 52 | usec_offset = new_usec; 53 | length = 4 + tagLen; 54 | } 55 | public Tag(int new_tag) { 56 | tag = new_tag; 57 | tagLen = 0; 58 | length = 4 + tagLen; 59 | } 60 | public byte[] toByteArray() { 61 | ByteArrayOutputStream os = new ByteArrayOutputStream(); 62 | os.write(length); 63 | os.write(tag); 64 | os.write(tagLen); 65 | if (time_offset != null) { 66 | os.write(time_offset.intValue()); 67 | } 68 | if (usec_offset != null) { 69 | os.write(usec_offset.intValue()); 70 | } 71 | return os.toByteArray(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/crypto/Crc32CksumType.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal.crypto; 32 | 33 | import sun.security.krb5.*; 34 | import sun.security.krb5.internal.*; 35 | import java.util.zip.CRC32; 36 | 37 | public class Crc32CksumType extends CksumType { 38 | 39 | public Crc32CksumType() { 40 | } 41 | 42 | public int confounderSize() { 43 | return 0; 44 | } 45 | 46 | public int cksumType() { 47 | return Checksum.CKSUMTYPE_CRC32; 48 | } 49 | 50 | public boolean isSafe() { 51 | return false; 52 | } 53 | 54 | public int cksumSize() { 55 | return 4; 56 | } 57 | 58 | public int keyType() { 59 | return Krb5.KEYTYPE_NULL; 60 | } 61 | 62 | public int keySize() { 63 | return 0; 64 | } 65 | 66 | public byte[] calculateChecksum(byte[] data, int size) { 67 | return crc32.byte2crc32sum_bytes(data, size); 68 | } 69 | 70 | public byte[] calculateKeyedChecksum(byte[] data, int size, 71 | byte[] key, int usage) { 72 | return null; 73 | } 74 | 75 | public boolean verifyKeyedChecksum(byte[] data, int size, 76 | byte[] key, byte[] checksum, int usage) { 77 | return false; 78 | } 79 | 80 | public static byte[] int2quad(long input) { 81 | byte[] output = new byte[4]; 82 | for (int i = 0; i < 4; i++) { 83 | output[i] = (byte)((input >>> (i * 8)) & 0xff); 84 | } 85 | return output; 86 | } 87 | 88 | public static long bytes2long(byte[] input) { 89 | long result = 0; 90 | 91 | result |= (((long)input[0]) & 0xffL) << 24; 92 | result |= (((long)input[1]) & 0xffL) << 16; 93 | result |= (((long)input[2]) & 0xffL) << 8; 94 | result |= (((long)input[3]) & 0xffL); 95 | return result; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/crypto/DesCbcCrcEType.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal.crypto; 32 | 33 | import sun.security.krb5.Checksum; 34 | import sun.security.krb5.EncryptedData; 35 | import sun.security.krb5.KrbCryptoException; 36 | import sun.security.krb5.internal.*; 37 | 38 | public class DesCbcCrcEType extends DesCbcEType { 39 | 40 | public DesCbcCrcEType() { 41 | } 42 | 43 | public int eType() { 44 | return EncryptedData.ETYPE_DES_CBC_CRC; 45 | } 46 | 47 | public int minimumPadSize() { 48 | return 4; 49 | } 50 | 51 | public int confounderSize() { 52 | return 8; 53 | } 54 | 55 | public int checksumType() { 56 | return Checksum.CKSUMTYPE_CRC32; 57 | } 58 | 59 | public int checksumSize() { 60 | return 4; 61 | } 62 | 63 | /** 64 | * Encrypts data using DES in CBC mode with CRC32. 65 | * @param data the data to be encrypted. 66 | * @param key the secret key to encrypt the data. It is also used as initialization vector during cipher block chaining. 67 | * @return the buffer for cipher text. 68 | * 69 | * @written by Yanni Zhang, Dec 10, 1999 70 | */ 71 | public byte[] encrypt(byte[] data, byte[] key, int usage) 72 | throws KrbCryptoException { 73 | return encrypt(data, key, key, usage); 74 | } 75 | 76 | /** 77 | * Decrypts data with provided key using DES in CBC mode with CRC32. 78 | * @param cipher the cipher text to be decrypted. 79 | * @param key the secret key to decrypt the data. 80 | * 81 | * @written by Yanni Zhang, Dec 10, 1999 82 | */ 83 | public byte[] decrypt(byte[] cipher, byte[] key, int usage) 84 | throws KrbApErrException, KrbCryptoException{ 85 | return decrypt(cipher, key, key, usage); 86 | } 87 | 88 | protected byte[] calculateChecksum(byte[] data, int size) { 89 | return crc32.byte2crc32sum_bytes(data, size); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/crypto/DesCbcMd5EType.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal.crypto; 32 | 33 | import sun.security.krb5.internal.*; 34 | import sun.security.krb5.Checksum; 35 | import sun.security.krb5.EncryptedData; 36 | import sun.security.krb5.KrbCryptoException; 37 | import java.security.MessageDigest; 38 | import java.security.Provider; 39 | import java.security.Security; 40 | 41 | public final class DesCbcMd5EType extends DesCbcEType { 42 | 43 | public DesCbcMd5EType() { 44 | } 45 | 46 | public int eType() { 47 | return EncryptedData.ETYPE_DES_CBC_MD5; 48 | } 49 | 50 | public int minimumPadSize() { 51 | return 0; 52 | } 53 | 54 | public int confounderSize() { 55 | return 8; 56 | } 57 | 58 | public int checksumType() { 59 | return Checksum.CKSUMTYPE_RSA_MD5; 60 | } 61 | 62 | public int checksumSize() { 63 | return 16; 64 | } 65 | 66 | /** 67 | * Calculates checksum using MD5. 68 | * @param data the input data. 69 | * @param size the length of data. 70 | * @return the checksum. 71 | * 72 | * @modified by Yanni Zhang, 12/06/99. 73 | */ 74 | protected byte[] calculateChecksum(byte[] data, int size) 75 | throws KrbCryptoException { 76 | MessageDigest md5 = null; 77 | try { 78 | md5 = MessageDigest.getInstance("MD5"); 79 | } catch (Exception e) { 80 | throw new KrbCryptoException("JCE provider may not be installed. " + e.getMessage()); 81 | } 82 | try { 83 | md5.update(data); 84 | return(md5.digest()); 85 | } catch (Exception e) { 86 | throw new KrbCryptoException(e.getMessage()); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/crypto/KeyUsage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | /* 27 | */ 28 | 29 | package sun.security.krb5.internal.crypto; 30 | 31 | /** 32 | * Key usages used for key derivation in Kerberos. 33 | */ 34 | public class KeyUsage { 35 | 36 | private KeyUsage() { 37 | } 38 | 39 | public static final int KU_UNKNOWN = 0; // Cannot be 0 40 | 41 | // Defined in draft-yu-krb-wg-kerberos-extensions-00.txt, Appendix A 42 | public static final int KU_PA_ENC_TS = 1; // KrbAsReq 43 | public static final int KU_TICKET = 2; // KrbApReq (ticket) 44 | public static final int KU_ENC_AS_REP_PART = 3; // KrbAsRep 45 | public static final int KU_TGS_REQ_AUTH_DATA_SESSKEY= 4; // KrbTgsReq 46 | public static final int KU_TGS_REQ_AUTH_DATA_SUBKEY = 5; // KrbTgsReq 47 | public static final int KU_PA_TGS_REQ_CKSUM = 6; // KrbTgsReq 48 | public static final int KU_PA_TGS_REQ_AUTHENTICATOR = 7; // KrbApReq 49 | public static final int KU_ENC_TGS_REP_PART_SESSKEY = 8; // KrbTgsRep 50 | public static final int KU_ENC_TGS_REP_PART_SUBKEY = 9; // KrbTgsRep 51 | public static final int KU_AUTHENTICATOR_CKSUM = 10; 52 | public static final int KU_AP_REQ_AUTHENTICATOR = 11; // KrbApReq 53 | public static final int KU_ENC_AP_REP_PART = 12; // KrbApRep 54 | public static final int KU_ENC_KRB_PRIV_PART = 13; // KrbPriv 55 | public static final int KU_ENC_KRB_CRED_PART = 14; // KrbCred 56 | public static final int KU_KRB_SAFE_CKSUM = 15; // KrbSafe 57 | public static final int KU_PA_FOR_USER_ENC_CKSUM = 17; // S4U2user 58 | public static final int KU_AD_KDC_ISSUED_CKSUM = 19; 59 | 60 | public static final boolean isValid(int usage) { 61 | return usage >= 0; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/crypto/Nonce.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | /* 27 | * 28 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 29 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 30 | */ 31 | 32 | package sun.security.krb5.internal.crypto; 33 | 34 | public class Nonce { 35 | 36 | public static synchronized int value() { 37 | return sun.security.krb5.Confounder.intValue() & 0x7fffffff; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/crypto/NullEType.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 27 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 28 | */ 29 | 30 | package sun.security.krb5.internal.crypto; 31 | 32 | import sun.security.krb5.Checksum; 33 | import sun.security.krb5.EncryptedData; 34 | import sun.security.krb5.internal.*; 35 | 36 | public class NullEType extends EType { 37 | 38 | public NullEType() { 39 | } 40 | 41 | public int eType() { 42 | return EncryptedData.ETYPE_NULL; 43 | } 44 | 45 | public int minimumPadSize() { 46 | return 0; 47 | } 48 | 49 | public int confounderSize() { 50 | return 0; 51 | } 52 | 53 | public int checksumType() { 54 | return Checksum.CKSUMTYPE_NULL; 55 | } 56 | 57 | public int checksumSize() { 58 | return 0; 59 | } 60 | 61 | public int blockSize() { 62 | return 1; 63 | } 64 | 65 | public int keyType() { 66 | return Krb5.KEYTYPE_NULL; 67 | } 68 | 69 | public int keySize() { 70 | return 0; 71 | } 72 | 73 | public byte[] encrypt(byte[] data, byte[] key, int usage) { 74 | byte[] cipher = new byte[data.length]; 75 | System.arraycopy(data, 0, cipher, 0, data.length); 76 | return cipher; 77 | } 78 | 79 | public byte[] encrypt(byte[] data, byte[] key, byte[] ivec, int usage) { 80 | byte[] cipher = new byte[data.length]; 81 | System.arraycopy(data, 0, cipher, 0, data.length); 82 | return cipher; 83 | } 84 | 85 | public byte[] decrypt(byte[] cipher, byte[] key, int usage) 86 | throws KrbApErrException { 87 | return cipher.clone(); 88 | } 89 | 90 | public byte[] decrypt(byte[] cipher, byte[] key, byte[] ivec, int usage) 91 | throws KrbApErrException { 92 | return cipher.clone(); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/ktab/KeyTabConstants.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal.ktab; 32 | 33 | import sun.security.krb5.internal.*; 34 | 35 | /** 36 | * This class represents a Key Table entry. Each entry contains the service principal of 37 | * the key, time stamp, key version and secret key itself. 38 | * 39 | * @author Yanni Zhang 40 | */ 41 | public interface KeyTabConstants { 42 | final int principalComponentSize = 2; 43 | final int realmSize = 2; 44 | final int principalSize = 2; 45 | final int principalTypeSize = 4; 46 | final int timestampSize = 4; 47 | final int keyVersionSize = 1; 48 | final int keyTypeSize = 2; 49 | final int keySize = 2; 50 | static final int KRB5_KT_VNO_1 = 0x0501; /* krb v5, keytab version 1 (DCE compat) */ 51 | static final int KRB5_KT_VNO = 0x0502; /* krb v5, keytab version 2 (standard) */ 52 | } 53 | -------------------------------------------------------------------------------- /java/sun/security/krb5/internal/util/KrbDataOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 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 it 5 | * under the terms of the GNU General Public License version 2 only, as 6 | * published by the Free Software Foundation. Oracle designates this 7 | * particular file as subject to the "Classpath" exception as provided 8 | * 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 WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * version 2 for more details (a copy is included in the LICENSE file that 14 | * accompanied this code). 15 | * 16 | * You should have received a copy of the GNU General Public License version 17 | * 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 USA 21 | * or visit www.oracle.com if you need additional information or have any 22 | * questions. 23 | */ 24 | 25 | /* 26 | * 27 | * (C) Copyright IBM Corp. 1999 All Rights Reserved. 28 | * Copyright 1997 The Open Group Research Institute. All rights reserved. 29 | */ 30 | 31 | package sun.security.krb5.internal.util; 32 | 33 | import java.io.BufferedOutputStream; 34 | import java.io.IOException; 35 | import java.io.OutputStream; 36 | 37 | /** 38 | * This class implements a buffered output stream. It provides methods to write a chunck of 39 | * bytes to underlying data stream. 40 | * 41 | * @author Yanni Zhang 42 | * 43 | */ 44 | public class KrbDataOutputStream extends BufferedOutputStream { 45 | public KrbDataOutputStream(OutputStream os) { 46 | super(os); 47 | } 48 | public void write32(int num) throws IOException { 49 | byte[] bytes = new byte[4]; 50 | bytes[0] = (byte)((num & 0xff000000) >> 24 & 0xff); 51 | bytes[1] = (byte)((num & 0x00ff0000) >> 16 & 0xff); 52 | bytes[2] = (byte)((num & 0x0000ff00) >> 8 & 0xff); 53 | bytes[3] = (byte)(num & 0xff); 54 | write(bytes, 0, 4); 55 | } 56 | 57 | public void write16(int num) throws IOException { 58 | byte[] bytes = new byte[2]; 59 | bytes[0] = (byte)((num & 0xff00) >> 8 & 0xff); 60 | bytes[1] = (byte)(num & 0xff); 61 | write(bytes, 0, 2); 62 | } 63 | 64 | public void write8(int num) throws IOException { 65 | write(num & 0xff); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /java/sun/security/util/ByteArrayLexOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | 27 | package sun.security.util; 28 | 29 | import java.util.Comparator; 30 | 31 | /** 32 | * Compare two byte arrays in lexicographical order. 33 | * 34 | * @author D. N. Hoover 35 | */ 36 | public class ByteArrayLexOrder implements Comparator { 37 | 38 | /** 39 | * Perform lexicographical comparison of two byte arrays, 40 | * regarding each byte as unsigned. That is, compare array entries 41 | * in order until they differ--the array with the smaller entry 42 | * is "smaller". If array entries are 43 | * equal till one array ends, then the longer array is "bigger". 44 | * 45 | * @param bytes1 first byte array to compare. 46 | * @param bytes2 second byte array to compare. 47 | * @return negative number if bytes1 < bytes2, 0 if bytes1 == bytes2, 48 | * positive number if bytes1 > bytes2. 49 | * 50 | * @exception ClassCastException 51 | * if either argument is not a byte array. 52 | */ 53 | public final int compare( byte[] bytes1, byte[] bytes2) { 54 | int diff; 55 | for (int i = 0; i < bytes1.length && i < bytes2.length; i++) { 56 | diff = (bytes1[i] & 0xFF) - (bytes2[i] & 0xFF); 57 | if (diff != 0) { 58 | return diff; 59 | } 60 | } 61 | // if array entries are equal till the first ends, then the 62 | // longer is "bigger" 63 | return bytes1.length - bytes2.length; 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /java/sun/security/util/ByteArrayTagOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | 27 | /** 28 | * ByteArrayTagOrder: a class for comparing two DER encodings by the 29 | * order of their tags. 30 | * 31 | * @author D. N. Hoover 32 | */ 33 | 34 | package sun.security.util; 35 | 36 | import java.util.Comparator; 37 | 38 | public class ByteArrayTagOrder implements Comparator { 39 | 40 | /** 41 | * Compare two byte arrays, by the order of their tags, 42 | * as defined in ITU-T X.680, sec. 6.4. (First compare 43 | * tag classes, then tag numbers, ignoring the constructivity bit.) 44 | * 45 | * @param bytes1 first byte array to compare. 46 | * @param bytes2 second byte array to compare. 47 | * @return negative number if bytes1 < bytes2, 0 if bytes1 == bytes2, 48 | * positive number if bytes1 > bytes2. 49 | * 50 | * @exception ClassCastException 51 | * if either argument is not a byte array. 52 | */ 53 | 54 | public final int compare(byte[] bytes1, byte[] bytes2) { 55 | // tag order is same as byte order ignoring any difference in 56 | // the constructivity bit (0x02) 57 | return (bytes1[0] | 0x20) - (bytes2[0] | 0x20); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /java/sun/security/util/DerEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.security.util; 27 | 28 | import java.io.IOException; 29 | import java.io.OutputStream; 30 | 31 | /** 32 | * Interface to an object that knows how to write its own DER 33 | * encoding to an output stream. 34 | * 35 | * @author D. N. Hoover 36 | */ 37 | public interface DerEncoder { 38 | 39 | /** 40 | * DER encode this object and write the results to a stream. 41 | * 42 | * @param out the stream on which the DER encoding is written. 43 | */ 44 | public void derEncode(OutputStream out) 45 | throws IOException; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /java/sun/util/calendar/Gregorian.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 | * 5 | * This code is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 only, as 7 | * published by the Free Software Foundation. Oracle designates this 8 | * particular file as subject to the "Classpath" exception as provided 9 | * by Oracle in the LICENSE file that accompanied this code. 10 | * 11 | * This code is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * version 2 for more details (a copy is included in the LICENSE file that 15 | * accompanied this code). 16 | * 17 | * You should have received a copy of the GNU General Public License version 18 | * 2 along with this work; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 | * or visit www.oracle.com if you need additional information or have any 23 | * questions. 24 | */ 25 | 26 | package sun.util.calendar; 27 | 28 | import java.util.TimeZone; 29 | 30 | /** 31 | * Gregorian calendar implementation. 32 | * 33 | * @author Masayoshi Okutsu 34 | * @since 1.5 35 | */ 36 | 37 | public class Gregorian extends BaseCalendar { 38 | 39 | static class Date extends BaseCalendar.Date { 40 | protected Date() { 41 | super(); 42 | } 43 | 44 | protected Date(TimeZone zone) { 45 | super(zone); 46 | } 47 | 48 | public int getNormalizedYear() { 49 | return getYear(); 50 | } 51 | 52 | public void setNormalizedYear(int normalizedYear) { 53 | setYear(normalizedYear); 54 | } 55 | } 56 | 57 | Gregorian() { 58 | } 59 | 60 | public String getName() { 61 | return "gregorian"; 62 | } 63 | 64 | public Date getCalendarDate() { 65 | return getCalendarDate(System.currentTimeMillis(), newCalendarDate()); 66 | } 67 | 68 | public Date getCalendarDate(long millis) { 69 | return getCalendarDate(millis, newCalendarDate()); 70 | } 71 | 72 | public Date getCalendarDate(long millis, CalendarDate date) { 73 | return (Date) super.getCalendarDate(millis, date); 74 | } 75 | 76 | public Date getCalendarDate(long millis, TimeZone zone) { 77 | return getCalendarDate(millis, newCalendarDate(zone)); 78 | } 79 | 80 | public Date newCalendarDate() { 81 | return new Date(); 82 | } 83 | 84 | public Date newCalendarDate(TimeZone zone) { 85 | return new Date(zone); 86 | } 87 | } 88 | --------------------------------------------------------------------------------