Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,546
Community Members
 
Community Events
185
Community Groups

How to get a user's login details with scriptrunner

How to get a user's login details with scriptrunner

1 answer

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 02, 2023

Welcome to the Atlassian Community!

I am sorry that I do not quite understand the question, and need to ask for a bit more detail.

What "login details" are you looking for?  

When someone logs into Jira, Jira uses the configured identity provider system(s) to ask the user to uniquely identify themselves, so that it knows that the account logged into belongs to the person logging in.

In the basic case, all you really have available is "this account can log in", "unique ID for this account (with associated display name and email)" and "has logged in".

You can then go off and ask the IDP for more detail about the account in SR, but what you can extract from that depends entirely on the IDP and how it's been integrated.

So, could you clarify "login details" for us?

Login details is what administrators can see when they hit "User management" -> "Users". Is there a way to get this information on the screenshot? with scriptrunner

Screenshot from 2023-05-02 18-30-02.png

Ken McClean
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 03, 2023 • edited

You can use the LoginManager class to accomplish this. Here's an example that returns the login count of the supplied user:


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.login.LoginManager

def loginManager = ComponentAccessor.getComponent(LoginManager)
def loginDetails = loginManager.getLoginInfo("admin")

loginDetails.getLoginCount()

 


Worth noting is that if you're working with timestamps such as LastLoginDate, it'll be returned in the Unix Epoch format. So you'll need to do some conversion.
Like Egor Braguntsov likes this

Thanks, that's what I needed

Suggest an answer

Log in or Sign up to answer