Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Contributor
Posts: 18
Registered: ‎10-19-2015
Accepted Solution

Using Active Directory in Standalone Workflows (WindowsAuthorizationExtension)

[ Edited ]

Hi

 

I'm searching for the .Net code of a dll called AuthorisationExtension. I want to configure Smart Client Workflows to run as a standalone workflow using Windows Authentication and Active Directory. There was a pdf about two years ago explaning how to configure it by using this dll. Can someone provide the code of this dll or a similar example?

 

Thanks

Carmen

Highlighted
Occasional Contributor
Posts: 18
Registered: ‎10-19-2015

Re: Using Active Directory in Standalone Workflows (WindowsAuthorizationExtension)

A colleague found similar code in a project and it seems to work:

 

using System.Web.Security;
using Intergraph.Emea.Diagnostics.Log;
using Intergraph.Emea.Security;
using Intergraph.Emea.Workflows;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Web;

namespace Intergraph.CH.Workflows
{
    public class SSOAuthorization : IAuthorizationProvider
    {
        public UserInfo GetUser(SessionState sessionState)
        {
            WindowsIdentity identity = HttpContext.Current.Request.LogonUserIdentity;
            if (identity != null)
            {
                Log.DefaultLog.Warn(string.Format("GetUser: {0})", identity.Name));
                return new UserInfo(identity.Name, null);
            }
            return null;
        }

        public bool HasClaim(SessionState sessionState, params string[] claims)
        {
            throw new NotImplementedException();
        }

        public bool IsAuthorized(SessionState sessionState)
        {
            return true;
        }

        public bool IsInRole(SessionState sessionState, params string[] roles)
        {
            var httpContextProvider = new HttpContextProvider();
            var user = httpContextProvider.GetHttpContext().User;

            foreach (string role in roles)
                if (user.IsInRole(role))
                    return true;
            return false;
        }
    }
}

Regards

Regular Contributor
Posts: 185
Registered: ‎08-10-2016

Re: Using Active Directory in Standalone Workflows (WindowsAuthorizationExtension)

Kindly, how do i implement this code for my standalone workflow after compling to a dll?

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.