This works in designer but when I run the session it shows red exclamation mark "null" error.
Do you have anyone authenticated through an IdP in the session?
If I recall correctly, the designer 'automatically' fills the authentication fields with information from the user who logged into the designer. (This may depend on some settings). I don't believe a launched session (Chrome, app, workstation) automatically authenticates a user.
The Client tags only work in Vision Clients, not Perspective Sessions.
Sorry I did explain clearly. I am trying to bind a label value in perspective window with session properties "userName" and 'userRole'. It shows for example "Admin" and "Administrator" in the designer but when I launch session it shows null with red error overlay.
Is there a way to write username and userRole on a tag which I can bind my component to?
You need to post a screenshot of what you are attempting becuase there is no userRole
property available at the session level.
Perspective auth properties have the following structure:
Now, assuming you_are_ using session properties in some way, bindings against those properties would not have the red quality overlay unless the binding is unable to resolve for some reason. Typically this is due to transforms when they receive unexpected data. You mentioned that your binding is working in the designer, but not in a session, which means there's something different between the two sessions. This is most likely the user, so who is logged into the browser session.
A lot of people have issues while using the auth properties because they assume a user is always logged in, but this is not true if your project has not been configured to require authentication. Perhaps no one is logged into your session?
What I am trying to do is build a namespace in my tag hierarchy. All the screens will use data from namespace. How can I save info like username and userrole in my tag hierarchy so that I can use it in both perspecive and vision screens?
You cannot. Gateway tags are global. Perspective has custom session properties and Vision has Client Tags.
Yes and there has to be a way to utilize this information somehow.
Why in tags? You already have a single source of user data in the usersource. Check this and related, that source works for Vision and Perspective.
I am having the same issue but in my case the users are logging into a perspective session and I can validate the roles required of the user but I cannot get the firstName to bind to anything without getting Null. Yes I do get it working in the designer but that doesn't help this issue.
You can't write to the username (although you can in Designer - either as an unintended feature or intended to ease development). When you launch the app the user props are set by Ignition's user authentication.
Saying it a different way, you can't bind the firstName to anything but you can bind something else to firstName to read it.
You can, of course, read the user props and bind a component to the user props.
There is no requirement on the Gateway side that all users supply a first name when they make their account in the User Source.
Knowing this, there are two scenarios where I would not be surprised if a Label bound to session.props.user.firstName
displayed null
:
- The project in use does not require authentication and the user is not authenticated. No user, no firstName.
- The user of the session has authenticated, yet their record in the User Source has no firstName value.
We use a corporate AD group to sign in with. I did try to bind firstName which has the values I need showing in the designer, to a custom property but it still gave me a Null. I wonder if I am missing something in the IDP user attribute mapping.
Are you really trying to bind firstName to something else or are you trying to bind a component (such as a label's text property or a custom prop) to the firstName session property? Word order is important here.
If you need to see what AD is serving up then I recommend you download and install Microsoft's AD Explorer. Log in as yourself.
I have tried all those things. I even tried to pass it as a parameter when opening a view. I wonder if I am missing something in the IDP User Attributes in the gateway. We use a corporate AD setup to do logins.
It's still not clear what you are trying to do.
Are you just trying to display the name of the logged in user?
Why? It is the designer, not the normal project auth. It doesn't have access to the true auth properties.
If you run an actual session, and log in with an AD user, and you still get null, then you need to talk to your IT group about filling in these fields in AD, and/or getting them mapped properly in your IdP response.
You cannot force these auth properties to have anything but their automatic values. You can use coalesce()
in an expression in your label to show something else when it is null.
I send scripted emails when a controls engineer makes a network or IP change to a PLC. I created a perspective popup that takes the data and sends the email in an HTML format but I am trying to take the name of who is making the change and add it to the email without requiring them to enter it since you have to login to even get to the page as it is restricted to controls engineers.
You are correct Phil. I am not pulling that from the IDP reply but will get that fixed. I am however able to use the data it is pulling like roles and ID number but no name was requested originally when we set up SSO.