12-01-2021 12:53 PM - edited 12-02-2021 03:07 PM
Hello everyone,
I hope you are doing well. I have Okta integrated with Jamf through Jamf Connect, I am wondering is it somehow possible to pass user's Full Name or at least Username in Okta to Jamf / Mac.
What I am trying to do is to change computer name to be the same as the name of the Okta user.
So far my closest success to this was to create script that takes username or alias(alias has precedence) of the currently logged in user and sets it as computer name. Code is below:
#!/bin/bash
admin1="admin1"
admin2="admin2"
# get username of the currently logged in user
username=$(/usr/bin/logname)
# get currently logged in user's alias if alias is not available, username will be used instead
alias=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name && ! /loginwindow/ { print $3 }' )
# If logged in user is not one of local admins that are for IT personel
if [ $username != $admin1 ] && [ $username != $admin2 ]; then
if [ $username == $alias ]; then
/usr/local/bin/jamf setcomputername -name $username
/usr/local/bin/jamf recon
else
/usr/local/bin/jamf setcomputername -name $alias
/usr/local/bin/jamf recon
fi
fi
Right now I do not have app integration in Okta created specifically for Jamf Connect integration.
Edit1:
In case someone needs this in the future, here's an example code:
# awk splits Okta username from Okta domain
okta_user=$(defaults read com.jamf.connect.state DisplayName | awk -F'@' '{print $1}')
/usr/local/bin/jamf setcomputername -name $okta_user
/usr/local/bin/jamf recon
Solved! Go to Solution.
12-01-2021 02:17 PM - edited 12-01-2021 02:19 PM
Are you having your users sign in to Okta when logged in? if so you can read the com.jamf.connect.state preference file for their Username and their Full Name:
defaults read com.jamf.connect.state UserShortName
defaults read com.jamf.connect.state DisplayName
More information here: https://docs.jamf.com/jamf-connect/2.6.0/documentation/State_Settings_and_User_Status.html
12-01-2021 02:17 PM - edited 12-01-2021 02:19 PM
Are you having your users sign in to Okta when logged in? if so you can read the com.jamf.connect.state preference file for their Username and their Full Name:
defaults read com.jamf.connect.state UserShortName
defaults read com.jamf.connect.state DisplayName
More information here: https://docs.jamf.com/jamf-connect/2.6.0/documentation/State_Settings_and_User_Status.html
Posted on 12-02-2021 06:22 AM
By sign in to Okta, do you refer to force Okta dashboard to open in lets say a browser and have user sign in?
Right now this is only enabled on lab machines, basically on the Mac login screen I have Jamf Connect window where I can login with Okta username + Password + 2FA.
Will test out what you have mentioned and go from there. Thanks a lot!!
Posted on 12-02-2021 03:06 PM
Update, your info helped out a lot, thanks again!
Posted on 01-11-2024 09:09 AM
Can tell me how your are resolving the issue I'm confused