/// <summary> /// Initializes a new instance of the BrokerNodeAuthManager class. /// </summary> /// <param name="jobId">job id of the soa session</param> internal BrokerNodeAuthManager(string jobId) { this.jobId = jobId; if (SoaHelper.IsCurrentUserLocal() || WindowsIdentity.GetCurrent().IsSystem) { this.enable = false; RuntimeTraceHelper.TraceEvent(this.jobId, TraceEventType.Information, "[HpcServiceHost]: BrokerNodeAuthManager is disabled in non-domain joined compute node."); } else { this.enable = true; this.allowedUser = WindowsIdentity.GetCurrent(); // If this environment does not exist, the jobOwnerUserName will remain null. // Thus the comparision will always fail so that HpcServiceHost will not authenticate job owner. this.jobOwnerUserName = Environment.GetEnvironmentVariable(Constant.JobOwnerNameEnvVar, EnvironmentVariableTarget.Process); RuntimeTraceHelper.TraceEvent( this.jobId, TraceEventType.Information, "[HpcServiceHost]: BrokerNodeAuthManager initialized. AllowerUser = {0}, JobOwner = {1}", this.allowedUser.Name, this.jobOwnerUserName); } }
/// <summary> /// Get the endpoint Uri for session launcher /// </summary> /// <param name="headnode">the headnode name</param> /// <param name="binding">indicating the binding</param> /// <param name="useInternalChannel">If connect to Session Launcher via internal channel</param> /// <returns>the SessionLauncher EPR</returns> public static Uri GetSessionLauncher(string headnode, Binding binding, bool useInternalChannel) { if (LocalSession.LocalBroker) { return(new Uri(SessionLauncherNetPipeAddress)); } else { return(new Uri((useInternalChannel || SoaHelper.IsCurrentUserLocal()) ? SoaHelper.GetSessionLauncherInternalAddress(headnode, binding) : SoaHelper.GetSessionLauncherAddress(headnode, binding))); } }
/// <summary> /// Get binding from configuration. If failed, fallback to default /// </summary> /// <returns>Binding Data</returns> private static Binding GetBinding(bool useInternalChannel) { // This file is shared by SessionAPI and BrokerLauncher // If for SessionAPI, it is necessary to check localbroker property for debug purpose #if API if (LocalSession.LocalBroker) { return(new NetNamedPipeBinding(NetNamedPipeSecurityMode.Transport)); } #endif if (useInternalChannel) { return(BindingHelper.HardCodedNoAuthSessionLauncherNetTcpBinding); } else if (SoaHelper.IsCurrentUserLocal()) { return(BindingHelper.HardCodedInternalSessionLauncherNetTcpBinding); } else { return(BindingHelper.HardCodedSessionLauncherNetTcpBinding); } }