@loopback/docs
Version:
Documentation for LoopBack 4
38 lines (24 loc) • 974 B
Markdown
lang: en
title: 'API docs: authentication.authenticationbindings.current_user'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.authentication.authenticationbindings.current_user.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/authentication](./authentication.md) > [AuthenticationBindings](./authentication.authenticationbindings.md) > [CURRENT\_USER](./authentication.authenticationbindings.current_user.md)
## AuthenticationBindings.CURRENT\_USER variable
Key used to inject the user instance retrieved by the authentication function
<b>Signature:</b>
```typescript
CURRENT_USER: BindingKey<UserProfile | undefined>
```
## Example
```ts
class MyController {
constructor(
@inject(AuthenticationBindings.CURRENT_USER) private user: UserProfile,
) {}
// ... routes that may need authentication
```
}