Skip to content

Instantly share code, notes, and snippets.

View ljlm0402's full-sized avatar

아구몬 ljlm0402

View GitHub Profile

소개

이 글은 Oauth를 이용해서 access token을 획득한 후에 api에 접속하는 방법에 대해서 설명하고 있습니다.

우선 공부해야 할 것들

이 글은 WEB2 OAuth2 수업과 WEB2 HTTP 수업에 의존하고 있습니다. OAuth와 HTTP를 잘 모르신다면 이 수업들을 먼저 보시고 이 글을 볼 것을 권해드립니다.

Bearer Authentication란?

API에 접속하기 위해서는 access token을 API 서버에 제출해서 인증을 해야 합니다. 이 때 사용하는 인증 방법이 Bearer Authentication 입니다. 이 방법은 OAuth를 위해서 고안된 방법이고, RFC 6750에 표준명세서가 있습니다.

@ljlm0402
ljlm0402 / auth_request.conf
Created October 6, 2022 01:19 — forked from nginx-gists/auth_request.conf
Validating OAuth 2.0 Access Tokens with NGINX and NGINX Plus
server {
listen 80;
location / {
auth_request /_oauth2_token_introspection;
proxy_pass http://my_backend;
}
location = /_oauth2_token_introspection {
internal;
@ljlm0402
ljlm0402 / README.md
Created October 6, 2022 01:26 — forked from lcrilly/README.md
NGINX OAuth 2.0 Token Introspection

OAuth 2.0 Token Introspection with NGINX and njs

This configuration enables NGINX to validate an authentication token against an authorization server by using OAuth 2.0 Token Introspection (RFC 7662). This solution uses the auth_request module and the NGINX JavaScript module to require authentication and perform the token introspection request.

By default, the client's authentication token is expected as a bearer token supplied in the Authorization header. If supplied elsewhere in the HTTP request, the $access_token variable must be configured to specify where to obtain the token.

Token introspection requests are authenticated. By default, the $oauth_client_id and $oauth_client_secret variables are used to perform HTTP Basic authentication with the Authorization Server. If only the $oauth_client_secret variable is specified then that value is used