# TaskListener - recognize claim event

**URL:** <https://forum.camunda.io/t/tasklistener-recognize-claim-event/48665>\
**Category:** Discussion & Questions\
**Created:** [November 7, 2023, 10:35am UTC](https://forum.camunda.io/t/tasklistener-recognize-claim-event/48665 "2023-11-07T10:35:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marco\_tanner](https://forum.camunda.io/user_avatar/forum.camunda.io/marco_tanner/32/24611_2.png) [@marco\_tanner](https://forum.camunda.io/u/marco_tanner)\
**Post date:** [November 7, 2023, 10:35am UTC](https://forum.camunda.io/t/tasklistener-recognize-claim-event/48665/1 "2023-11-07T10:35:53Z")

</div>

On Camunda 7.19, is it possible to recognize who fired the source event in a TaskListener?

I’m building an AssignmentListener similar to [the official example](https://github.com/camunda/camunda-bpm-examples/blob/20a4d7cc9bb9ebe0edb3a190807d8f9d7b7500c5/usertask/task-assignment-email/src/main/java/org/camunda/bpm/quickstart/TaskAssignmentListener.java)

The problem with this approach is, it’s also notified whenever a user claims a task for themself. It don’t deem it a good UX if I claim a task and then get notified about my own action.

Can I somehow recognize that the assignment was triggered by a ‘claim’ and ignore the event?

---

<div class="post-metadata">

**Author:** ![hassang](https://forum.camunda.io/user_avatar/forum.camunda.io/hassang/32/16498_2.png) [@hassang](https://forum.camunda.io/u/hassang)\
**Post date:** [November 19, 2023, 8:35am UTC](https://forum.camunda.io/t/tasklistener-recognize-claim-event/48665/2 "2023-11-19T08:35:40Z")

</div>

Hi @marco_tanner,

I believe below snippet of code should return who fired the assignment event.

```auto
IdentityService identityService = delegateTask.getProcessEngineServices().getIdentityService();

if (identityService.getCurrentAuthentication() != null) {
	userId = identityService.getCurrentAuthentication().getUserId();	    	
}

```

---

<div class="post-metadata">

**Author:** ![marco\_tanner](https://forum.camunda.io/user_avatar/forum.camunda.io/marco_tanner/32/24611_2.png) [@marco\_tanner](https://forum.camunda.io/u/marco_tanner)\
**Post date:** [November 21, 2023, 9:15am UTC](https://forum.camunda.io/t/tasklistener-recognize-claim-event/48665/3 "2023-11-21T09:15:16Z")

</div>

Hi @hassang ,

that could indeed work, I hope my calling code location acts as the current user and not just “as the server”. I will try this and give feedback.

thank you for your time

---

<div class="post-metadata">

**Author:** ![hassang](https://forum.camunda.io/user_avatar/forum.camunda.io/hassang/32/16498_2.png) [@hassang](https://forum.camunda.io/u/hassang)\
**Post date:** [November 22, 2023, 5:18am UTC](https://forum.camunda.io/t/tasklistener-recognize-claim-event/48665/4 "2023-11-22T05:18:14Z")

</div>

Hi @marco_tanner,

I believe that as long as the **authentication is enabled** , and your calling code is from within a **task listener** which is a reaction to a human interaction (claim), then current authentication should exist.
