# How to get username for stream

**URL:** <https://community.wowza.com/t/how-to-get-username-for-stream/49642>\
**Category:** Wowza Streaming Engine\
**Tags:** wowza-streaming-server-java-api\
**Created:** [September 7, 2017, 12:42pm UTC](https://community.wowza.com/t/how-to-get-username-for-stream/49642 "2017-09-07T12:42:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_Dogaru](https://avatars.discourse-cdn.com/v4/letter/g/48db29/32.png) [@Gabriel\_Dogaru](https://community.wowza.com/u/Gabriel_Dogaru)\
**Post date:** [September 7, 2017, 12:42pm UTC](https://community.wowza.com/t/how-to-get-username-for-stream/49642/1 "2017-09-07T12:42:55Z")

</div>

I need a module to validate that a specific user can create a stream with a particular name.

Is there a way to get the username used when authenticating for streaming?

---

<div class="post-metadata">

**Author:** ![Karel\_Boek](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/karel_boek/32/454_2.png) [@Karel\_Boek](https://community.wowza.com/u/Karel_Boek)\
**Post date:** [September 7, 2017, 5:58pm UTC](https://community.wowza.com/t/how-to-get-username-for-stream/49642/2 "2017-09-07T17:58:05Z")

</div>

Hi @Gabriel Dogaru

You can find some examples here [https://www.wowza.com/docs/how-to-integrate-wowza-user-authentication-with-external-authentication-systems-modulertmpauthenticate](https://www.wowza.com/docs/how-to-integrate-wowza-user-authentication-with-external-authentication-systems-modulertmpauthenticate) and here [https://github.com/above-solutions/wowza-publisherauth](https://github.com/above-solutions/wowza-publisherauth). Basically, it’s about extending the AuthenticateUsernamePasswordProviderBase class.

Let me know if you need someone to write this module for you 😉

---

<div class="post-metadata">

**Author:** ![Gabriel\_Dogaru](https://avatars.discourse-cdn.com/v4/letter/g/48db29/32.png) [@Gabriel\_Dogaru](https://community.wowza.com/u/Gabriel_Dogaru)\
**Post date:** [September 7, 2017, 6:04pm UTC](https://community.wowza.com/t/how-to-get-username-for-stream/49642/3 "2017-09-07T18:04:16Z")

</div>

I already have that part

My goal is to allow publish only to some of my system’s users to predefined stream names.

So, I am looking for a way to get the username in ModuleBase-\>onStreamCreate or in a stream listener

---

<div class="post-metadata">

**Author:** ![Karel\_Boek](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/karel_boek/32/454_2.png) [@Karel\_Boek](https://community.wowza.com/u/Karel_Boek)\
**Post date:** [September 7, 2017, 6:14pm UTC](https://community.wowza.com/t/how-to-get-username-for-stream/49642/4 "2017-09-07T18:14:21Z")

</div>

If you look at the AuthenticateUsernamePasswordProviderBase, it has a few fields that you could use to store the username, so that you can fetch it later; e.g. you can do this in getPassword:

```auto
this.client.getProperties().setProperty("username", username);

```

And then later you can use

```auto
String username = stream.getClient().getProperties.getPropertyStr("username");

```

By the way, I’d implement IMediaStreamActionNotify2 and do this in the onPublish method rather than in the onStreamCreate.

---

<div class="post-metadata">

**Author:** ![Karel\_Boek](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/karel_boek/32/454_2.png) [@Karel\_Boek](https://community.wowza.com/u/Karel_Boek)\
**Post date:** [September 7, 2017, 6:15pm UTC](https://community.wowza.com/t/how-to-get-username-for-stream/49642/5 "2017-09-07T18:15:15Z")

</div>

Oh, remember that stream.getClient() may not work in some cases where you don’t publish over RTMP …

---

<div class="post-metadata">

**Author:** ![Gabriel\_Dogaru](https://avatars.discourse-cdn.com/v4/letter/g/48db29/32.png) [@Gabriel\_Dogaru](https://community.wowza.com/u/Gabriel_Dogaru)\
**Post date:** [September 11, 2017, 3:13pm UTC](https://community.wowza.com/t/how-to-get-username-for-stream/49642/6 "2017-09-11T15:13:20Z")

</div>

how do I know if the login was successful?

in AuthenticateUsernamePasswordProviderBase I don’t think I have that info
