openshift/osin — 1.9k★ trên GitHub (Go). Golang OAuth2 server library
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
OSIN is an OAuth2 server library for the Go language, as specified at
http://tools.ietf.org/html/rfc6749 and http://tools.ietf.org/html/draft-ietf-oauth-v2-10.
It also includes support for PKCE, as specified at https://tools.ietf.org/html/rfc7636,
which increases security for code-exchange flows for public OAuth clients.
Using it, you can build your own OAuth2 authentication service.
The library implements the majority of the specification, like authorization and token endpoints, and authorization code, implicit, resource owner and client credentials grant types.
Example Server
import (
"github.com/openshift/osin"
ex "github.com/openshift/osin/example"
)
// ex.NewTestStorage implements the "osin.Storage" interface
server := osin.NewServer(osin.NewServerConfig(), ex.NewTestStorage())
// Authorization code endpoint
http.HandleFunc("/authorize", func(w http.ResponseWriter, r *http.Request) {
resp := server.NewResponse()
defer resp.Close()
if ar := server.HandleAuthorizeRequest(resp, r); ar != nil {
// HANDLE LOGIN PAGE HERE
ar.Authorized = true
server.FinishAuthorizeRequest(resp, r, ar)
}
osin.OutputJSON(resp, w, r)
})
// Access token endpoint
http.HandleFunc("/token", func(w http.ResponseWriter, r *http.Request) {
resp := server.NewResponse()
defer resp.Close()
if ar := server.HandleAccessRequest(resp, r); ar != nil {
ar.Authorized = true
server.FinishAccessRequest(resp, r, ar)
}
osin.OutputJSON(resp, w, r)
})
http.ListenAndServe(":14000", nil)
Updated imports in examples to use github.com/openshift/osin instead of github.com/RangelReale/osin
2014-06-25
BREAKING CHANGES:
Storage interface has 2 new methods, Clone and Close, to better support storages
that need to clone / close in each connection (mgo)
Client was changed to be an interface instead of an struct. Because of that,
the Storage interface also had to change, as interface is already a pointer.
HOW TO FIX YOUR CODE:
In your Storage, add a Clone function returning itself, and a do nothing Close.
In your Storage, replace all *osin.Client with osin.Client (remove the pointer reference)
If you used the osin.Client struct directly in your code, change it to osin.DefaultClient,
which is a struct with the same fields that implements the interface.
Change all accesses using osin.Client to use the methods instead of the fields directly.
You MUST defer Response.Close in all your http handlers, otherwise some
Storages may not clean correctly.
openshift/osin có 1.9k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/openshift/osin. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
openshift/osin có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho openshift/osin. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
openshift/osin còn đang phát triển không?
Commit gần nhất trên openshift/osin là 3 tháng trước (theo timestamp GitHub). Repo có 393 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
openshift/osin là gì?
openshift/osin (openshift/osin) là dự án Go trên GitHub. Theo mô tả gốc: Golang OAuth2 server library
openshift/osin viết bằng ngôn ngữ gì?
openshift/osin chủ yếu viết bằng Go. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
osin có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về osin.