コード例 #1
0
        internal static ClarifySession GetSession(AuthenticationHeader header)
        {
            if (header == null
                || header.SessionID == null
                || header.SessionID.Trim().Length == 0)
            {
                throw new InvalidOperationException("No Authentication Header provided.");
            }

            Guid sessionGuid = new Guid(header.SessionID);

            if (!ClarifyApplication.Instance.IsSessionValid(sessionGuid))
            {
                throw new InvalidOperationException(String.Format("Session with ID '{0}' does not exist or is no longer valid.", sessionGuid));
            }

            return ClarifyApplication.Instance.GetSession(sessionGuid);
        }