How to hide frontend with password?

I need frontend to be visible only for logged in admins.
How to implement it in Oxid?
I have some PHP knowledge, but do not know how It can be done with Oxid.

I have tried to check session in front end and get logged admin, but it seems like I have different sessions in back end and front end.

Have a look at page.tpl

Maybe you can do it like this:

[{if $oxcmp_user->oxuser__oxpassword->value && $oxcmp_user->oxuser__oxrights->value == "malladmin"}]
[{*...Your Page...*}] 
[{/if}] 

Thank you for answer, I am sure this code should work, but It does not work in my situation.
I make var_dump() for $oxcmp_user and result is ‘null’. It is empty, I do not know why.
And I am logged in.

Did you try [{ $oxcmp_user|@var_dump}]? It might not work the other way

I have tried

[{php}]
var_dump( $oxcmp_user);
[{/php}]

You variant also does not seem to work.

Then you have wrongly tested. It works. It must be given the possibility to log in. Accordingly it would be so to use: page.tpl line 45 seq:

<div class="col-xs-12 [{if $sidebar}]col-md-9[{/if}]">
[{if $oxcmp_user->oxuser__oxpassword->value && $oxcmp_user->oxuser__oxrights->value == "malladmin"}]
                            <div id="content">
                                [{block name="content_main"}]
                                    [{include file="message/errors.tpl"}]

                                    [{foreach from=$oxidBlock_content item="_block"}]
                                        [{$_block}]
                                    [{/foreach}]
                                [{/block}]
                            </div>
[{/if}]
                        </div>

Always remember to delete the tmp.

It seems to work now.
I tried to check from front end admin logged in back end and it failed.
When I logged in front end too, It became to work.

Just small mistake.