/* */ {
/* 375 */ long contextId = contextBody.in_context_msg().client_context_id;
/* */
/* 377 */ threadLocal.sasReply = createMsgCtxError(contextId, 4);
/* */
/* 380 */ throw new NO_PERMISSION("SAS context does not exist.");
/* */ }
/* 382 */ if (contextBody.discriminator() == 0)
/* */ {
/* 384 */ EstablishContext message = contextBody.establish_msg();
/* 385 */ threadLocal.contextId = message.client_context_id;
/* 386 */ threadLocal.sasContextReceived = true;
/* */
/* 388 */ if ((message.client_authentication_token != null) && (message.client_authentication_token.length > 0))
/* */ {
/* 391 */ if (traceEnabled)
/* 392 */ log.trace("received client authentication token");
/* 393 */ InitialContextToken authToken = CSIv2Util.decodeInitialContextToken(message.client_authentication_token, this.codec);
/* */
/* 397 */ if (authToken == null)
/* */ {
/* 399 */ threadLocal.sasReply = createMsgCtxError(message.client_context_id, 2);
/* */
/* 403 */ throw new NO_PERMISSION("Could not decode initial context token.");
/* */ }
/* */
/* 406 */ threadLocal.incomingUsername = authToken.username;
/* 407 */ threadLocal.incomingPassword = authToken.password;
/* 408 */ threadLocal.incomingTargetName = CSIv2Util.decodeGssExportedName(authToken.target_name);
/* */
/* 410 */ if (threadLocal.incomingTargetName == null)
/* */ {
/* 412 */ threadLocal.sasReply = createMsgCtxError(message.client_context_id, 2);
/* */
/* 416 */ throw new NO_PERMISSION("Could not decode target name in initial context token.");
/* */ }
/* */
/* 421 */ threadLocal.authenticationTokenReceived = true;
/* */ }
/* 423 */ if (message.identity_token != null)
/* */ {
/* 425 */ if (traceEnabled)
/* 426 */ log.trace("received identity token");
/* 427 */ threadLocal.incomingIdentity = message.identity_token;
/* 428 */ if (message.identity_token.discriminator() == 2)
/* */ {
/* 432 */ Any a = this.codec.decode_value(message.identity_token.principal_name(), GSS_NT_ExportedNameHelper.type());
/* */
/* 435 */ byte[] encodedName = GSS_NT_ExportedNameHelper.extract(a);
/* */
/* 438 */ threadLocal.incomingPrincipalName = CSIv2Util.decodeGssExportedName(encodedName);
/* */
/* 441 */ if (threadLocal.incomingPrincipalName == null)
/* */ {
/* 443 */ threadLocal.sasReply = createMsgCtxError(message.client_context_id, 2);
/* */
/* 447 */ throw new NO_PERMISSION("Could not decode incoming principal name.");
/* */ }
/* */ }
/* */ }
/* */
/* 452 */ threadLocal.sasReply = (threadLocal.contextId == 0L ? msgCtx0Accepted : createMsgCtxAccepted(threadLocal.contextId));