Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@elysiajs/bearer
Advanced tools
Plugin for elysia for retrieving Bearer token.
This plugin is for retrieving a Bearer token specified in RFC6750.
This plugin DOES NOT handle authentication validation for your server, rather the plugin leaves the decision for developers to apply logic for handle validation check themself.
bun add @elysiajs/bearer
import { Elysia } from 'elysia'
import { bearer } from '@elysiajs/bearer'
const app = new Elysia()
.use(bearer())
.get('/sign', ({ bearer }) => bearer, {
beforeHandle({ bearer, set }) {
if (!bearer) {
set.status = 400
set.headers[
'WWW-Authenticate'
] = `Bearer realm='sign', error="invalid_request"`
return 'Unauthorized'
}
}
})
.listen(8080)
This plugin decorates bearer
into Context
.
Extracted bearer token according to RFC6750, is either string
or undefined
,
If is undefined, means that there's no token provided.
Below is the configurable property for customizing the Bearer plugin.
Custom extractor for retrieving tokens when the API doesn't compliant with RFC6750.
/**
* If the API doesn't compliant with RFC6750
* The key for extracting the token is configurable
*/
extract: {
/**
* Determined which fields to be identified as Bearer token
*
* @default access_token
*/
body?: string
/**
* Determined which fields to be identified as Bearer token
*
* @default access_token
*/
query?: string
/**
* Determined which type of Authentication should be Bearer token
*
* @default Bearer
*/
header?: string
}
FAQs
Plugin for Elysia for retreiving Bearer token
The npm package @elysiajs/bearer receives a total of 5,276 weekly downloads. As such, @elysiajs/bearer popularity was classified as popular.
We found that @elysiajs/bearer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.