Beispiel #1
0
        // Return an authenticated oslc client. Throws exception in case not found.
        public OslcClient2 getOslcClient()
        {
            if (oslcClient != null)
            {
                return(oslcClient);
            }

            // Get the Friend info for mhweb
            FriendInfo friend = HandlerSettings.GetFriend("mhweb");

            if (friend == null)
            {
                throw new Exception(String.Format("Failed to get friend info for: {0}", "mhweb"));
            }

            if (friend.UseAccess == FriendInfo.UseAccessType.oauth)
            {
                oslcClient = getOAuthClient(friend);
            }
            else
            {
                oslcClient = getBasicAuthClient(friend);
            }

            if (oslcClient == null)
            {
                throw new Exception(String.Format("Failed to get OSLC client for: {0}", "mhweb"));
            }

            return(oslcClient);
        }