# Authentication only for Admin prefix

**URL:** <https://discourse.cakephp.org/t/authentication-only-for-admin-prefix/7114>\
**Category:** Need Help\
**Created:** [January 16, 2020, 6:25pm UTC](https://discourse.cakephp.org/t/authentication-only-for-admin-prefix/7114 "2020-01-16T18:25:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucian](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@lucian](https://discourse.cakephp.org/u/lucian)\
**Post date:** [January 16, 2020, 6:25pm UTC](https://discourse.cakephp.org/t/authentication-only-for-admin-prefix/7114/1 "2020-01-16T18:25:25Z")

</div>

Hy guys!

I haven’t been using Cake from gen 2 so i am a bit stuck with all the new stuff. I added the Authentication Component to my project and it works fine (login/out/pass hash etc) but i can’t seem to find how to make only the “Admin” prefix to require Authentication.

In the old times was something “simple” like:

if($this-\>params[‘prefix’] == ‘admin’){  
$this-\>Auth-\>deny(’\*’);  
}

---

<div class="post-metadata">

**Author:** ![Erwane](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/erwane/32/3253_2.png) [@Erwane](https://discourse.cakephp.org/u/Erwane)\
**Post date:** [February 26, 2021, 8:15am UTC](https://discourse.cakephp.org/t/authentication-only-for-admin-prefix/7114/2 "2021-02-26T08:15:35Z")

</div>

Hi.  
Did you found a nice solution ?
