@ioleksiy/nocobase-oauth2-proxy-auth
v1.8.4
Published
oAuth2-Proxy plugin: authenticate via oauth2-proxy headers and enforce user existence
Readme
NocoBase OAuth2 Proxy Auth
Authenticate NocoBase requests against users provisioned in your database when fronted by oauth2-proxy. The plugin inspects the x-auth-request-email header provided by oauth2-proxy, verifies that the user exists, and attaches the user to the NocoBase request context.
Installation
npm install @ioleksiy/nocobase-oauth2-proxy-authCompatibility
Requires
@nocobase/serverversion>=0.19.0 <2.0.0(includes the current1.xreleases).
Usage
Register the plugin inside your NocoBase application. The middleware will:
- Read the
x-auth-request-emailheader set by oauth2-proxy after a successful login. - Look up the matching user inside the
usersrepository. - Reject the request with
401if the header is missing or403if the user doesn't exist. - Attach the user to
ctx.state.currentUserfor downstream handlers.
const oauth2ProxyAuth = require('@ioleksiy/nocobase-oauth2-proxy-auth');
module.exports = ({ app }) => {
app.plugin(oauth2ProxyAuth);
};Make sure oauth2-proxy is configured to forward the X-Auth-Request-Email header and that the users authenticated through oauth2-proxy also exist in your NocoBase instance.
Development
- Update the package version in
package.jsonbefore publishing new releases. - The repository includes a GitHub Actions workflow that automatically publishes the package to npm when commits are pushed to the
mainbranch or when the workflow is triggered manually. Configure theNPM_TOKENsecret in the repository to enable automated publishing.
License
MIT
