com.sun.security.jgss.ExtendedGSSContext Java Examples
The following examples show how to use
com.sun.security.jgss.ExtendedGSSContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Context.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #2
Source File: Context.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #3
Source File: Context.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #4
Source File: Context.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #5
Source File: Context.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #6
Source File: Context.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #7
Source File: Context.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #8
Source File: Context.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #9
Source File: Context.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #10
Source File: Context.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #11
Source File: Context.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #12
Source File: Context.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #13
Source File: Context.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #14
Source File: Context.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #15
Source File: Context.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #16
Source File: Context.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #17
Source File: Context.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #18
Source File: Context.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #19
Source File: Context.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Starts as a client * @param target communication peer * @param mech GSS mech * @throws java.lang.Exception */ public void startAsClient(final String target, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext( target.indexOf('@') < 0 ? m.createName(target, null) : m.createName(target, GSSName.NT_HOSTBASED_SERVICE), mech, cred, GSSContext.DEFAULT_LIFETIME); return null; } }, null); }
Example #20
Source File: Context.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Starts as a server with the specified service name * @param name the service name * @param mech GSS mech * @throws java.lang.Exception */ public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.cred = m.createCredential( name == null ? null : (name.indexOf('@') < 0 ? m.createName(name, null) : m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, asInitiator? GSSCredential.INITIATE_AND_ACCEPT: GSSCredential.ACCEPT_ONLY); me.x = (ExtendedGSSContext)m.createContext(me.cred); return null; } }, null); }
Example #21
Source File: NewInquireTypes.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { new OneKDC(null).writeJAASConf(); Context c, s; c = Context.fromJAAS("client"); s = Context.fromJAAS("server"); c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); Context.handshake(c, s); ExtendedGSSContext ctxt = (ExtendedGSSContext)c.x(); EncryptionKey key = (EncryptionKey) ctxt.inquireSecContext(InquireType.KRB5_GET_SESSION_KEY_EX); KerberosCredMessage cred = (KerberosCredMessage) ctxt.inquireSecContext(InquireType.KRB5_GET_KRB_CRED); c.status(); // Confirm the KRB_CRED message is encrypted with the session key. new KRBCred(cred.getEncoded()).encPart.decrypt( new sun.security.krb5.EncryptionKey(key.getKeyType(), key.getEncoded()), KeyUsage.KU_ENC_KRB_CRED_PART); }
Example #22
Source File: SpNegoContext.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Retrieve attribute of the context for {@code type}. */ public Object inquireSecContext(InquireType type) throws GSSException { if (mechContext == null) { throw new GSSException(GSSException.NO_CONTEXT, -1, "Underlying mech not established."); } if (mechContext instanceof ExtendedGSSContext) { return ((ExtendedGSSContext)mechContext).inquireSecContext(type); } else { throw new GSSException(GSSException.BAD_MECH, -1, "inquireSecContext not supported by underlying mech."); } }
Example #23
Source File: SpNegoContext.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Retrieve attribute of the context for {@code type}. */ public Object inquireSecContext(InquireType type) throws GSSException { if (mechContext == null) { throw new GSSException(GSSException.NO_CONTEXT, -1, "Underlying mech not established."); } if (mechContext instanceof ExtendedGSSContext) { return ((ExtendedGSSContext)mechContext).inquireSecContext(type); } else { throw new GSSException(GSSException.BAD_MECH, -1, "inquireSecContext not supported by underlying mech."); } }
Example #24
Source File: GssKrb5Base.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public Object getNegotiatedProperty(String propName) { if (!completed) { throw new IllegalStateException("Authentication incomplete"); } String xprefix = "com.sun.security.jgss.inquiretype."; if (propName.startsWith(xprefix)) { String type = propName.substring(xprefix.length()); if (logger.isLoggable(Level.FINEST)) { logger.logp(Level.FINE, "GssKrb5Base", "getNegotiatedProperty", propName); } for (InquireType t: InquireType.values()) { if (t.name().toLowerCase(Locale.US).equals(type)) { try { return ((ExtendedGSSContext)secCtx).inquireSecContext(t); } catch (GSSException e) { if (logger.isLoggable(Level.FINEST)) { logger.log(Level.WARNING, "inquireSecContext error", e); } return null; } } } // No such InquireType. Although not likely to be defined // as a property in a parent class, still try it. } return super.getNegotiatedProperty(propName); }
Example #25
Source File: SpNegoContext.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Retrieve attribute of the context for {@code type}. */ public Object inquireSecContext(InquireType type) throws GSSException { if (mechContext == null) { throw new GSSException(GSSException.NO_CONTEXT, -1, "Underlying mech not established."); } if (mechContext instanceof ExtendedGSSContext) { return ((ExtendedGSSContext)mechContext).inquireSecContext(type); } else { throw new GSSException(GSSException.BAD_MECH, -1, "inquireSecContext not supported by underlying mech."); } }
Example #26
Source File: SpNegoContext.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Is deleg policy respected? */ public final boolean getDelegPolicyState() { if (isInitiator() && mechContext != null && mechContext instanceof ExtendedGSSContext && (state == STATE_IN_PROCESS || state == STATE_DONE)) { return ((ExtendedGSSContext)mechContext).getDelegPolicyState(); } else { return delegPolicyState; } }
Example #27
Source File: SpNegoContext.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Is deleg policy respected? */ public final boolean getDelegPolicyState() { if (isInitiator() && mechContext != null && mechContext instanceof ExtendedGSSContext && (state == STATE_IN_PROCESS || state == STATE_DONE)) { return ((ExtendedGSSContext)mechContext).getDelegPolicyState(); } else { return delegPolicyState; } }
Example #28
Source File: SpNegoContext.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Retrieve attribute of the context for {@code type}. */ public Object inquireSecContext(InquireType type) throws GSSException { if (mechContext == null) { throw new GSSException(GSSException.NO_CONTEXT, -1, "Underlying mech not established."); } if (mechContext instanceof ExtendedGSSContext) { return ((ExtendedGSSContext)mechContext).inquireSecContext(type); } else { throw new GSSException(GSSException.BAD_MECH, -1, "inquireSecContext not supported by underlying mech."); } }
Example #29
Source File: SpNegoContext.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Is deleg policy respected? */ public final boolean getDelegPolicyState() { if (isInitiator() && mechContext != null && mechContext instanceof ExtendedGSSContext && (state == STATE_IN_PROCESS || state == STATE_DONE)) { return ((ExtendedGSSContext)mechContext).getDelegPolicyState(); } else { return delegPolicyState; } }
Example #30
Source File: SpNegoContext.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Is deleg policy respected? */ public final boolean getDelegPolicyState() { if (isInitiator() && mechContext != null && mechContext instanceof ExtendedGSSContext && (state == STATE_IN_PROCESS || state == STATE_DONE)) { return ((ExtendedGSSContext)mechContext).getDelegPolicyState(); } else { return delegPolicyState; } }