Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Current login failed reset with curl

Deleted user April 11, 2019

I want to use REST api with curl and reset current login failed attempt to 0 when it turns to non zero digit..i am new to REST api can anybody help me with this.

1 answer

1 accepted

4 votes
Answer accepted
Rafael Pinto Sperafico
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.
April 11, 2019

Hi @[deleted] ,

Is there any particular reason for resetting failed login attempts? If the user that is experiencing issues with log in provides the correct credentials, this should reset the counter, therefore the user should log in.

There is not REST API available to reset failed login count. Instead, you would have to mimic the web request, providing a token/session to the request and bypass websudo. Here is an example for Jira:

Create a new session for a Jira user:

# replace ADMIN_USERNAME and ADMIN_PASSWORD to authenticate against Jira
# replace http://localhost:8080, with Jira's Base URL

curl -k -v \
-H 'Content-type: application/json' \
-d '{"username": "ADMIN_USERNAME","password": "ADMIN_PASSWORD"}' \
-X POST http://localhost:8080/rest/auth/1/session

As a response, you should expect:

{"session":{"name":"JSESSIONID","value":"D5DB341DC48BDBE65582086BBFCEF65F"},"loginInfo"....

Consuming the response from above, run the following Web Request

# replace ADMIN_USERNAME, with a Jira administrator
# replace D5DB341DC48BDBE65582086BBFCEF65F, with JSESSION retrieved from previous endpoint
# replace http://localhost:8080, with Jira's Base URL
# replace USERNAME, with user that reset current login failed

curl -k -v -u ADMIN_USERNAME \
-H "X-Atlassian-Token: no-check" \
-b "JSESSIONID=D5DB341DC48BDBE65582086BBFCEF65F;" \
-X GET http://localhost:8080/secure/admin/user/ResetFailedLoginCount.jspa?name=USERNAME

The above shall give you a HTTP/1.1 302 as HTTP response header, resetting failed login attempts.

Kind regards,
Rafael

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events