MCPcopy
hub / github.com/ory/hydra / SetPublicRoutes

Method SetPublicRoutes

oauth2/handler.go:87–129  ·  view source on GitHub ↗
(public *httprouterx.RouterPublic, corsMiddleware func(http.Handler) http.Handler)

Source from the content-addressed store, hash-verified

85}
86
87func (h *Handler) SetPublicRoutes(public *httprouterx.RouterPublic, corsMiddleware func(http.Handler) http.Handler) {
88 public.Handler("OPTIONS", TokenPath, corsMiddleware(http.HandlerFunc(h.handleOptions)))
89 public.Handler("POST", TokenPath, corsMiddleware(http.HandlerFunc(h.oauth2TokenExchange)))
90
91 public.GET(AuthPath, h.oAuth2Authorize)
92 public.POST(AuthPath, h.oAuth2Authorize)
93 public.GET(LogoutPath, h.performOidcFrontOrBackChannelLogout)
94 public.POST(LogoutPath, h.performOidcFrontOrBackChannelLogout)
95
96 public.GET(DefaultLoginPath, h.fallbackHandler("", "", http.StatusOK, config.KeyLoginURL))
97 public.GET(DefaultConsentPath, h.fallbackHandler("", "", http.StatusOK, config.KeyConsentURL))
98 public.GET(DefaultLogoutPath, h.fallbackHandler("", "", http.StatusOK, config.KeyLogoutURL))
99 public.GET(DefaultPostLogoutPath, h.fallbackHandler(
100 "You logged out successfully!",
101 "The Default Post Logout URL is not set which is why you are seeing this fallback page. Your log out request however succeeded.",
102 http.StatusOK,
103 config.KeyLogoutRedirectURL,
104 ))
105 public.GET(DefaultDeviceVerificationPath, h.fallbackHandler("", "", http.StatusOK, config.KeyDeviceVerificationURL))
106 public.GET(DefaultPostDevicePath, h.fallbackHandler(
107 "You successfully authenticated on your device!",
108 "The Default Post Device URL is not set which is why you are seeing this fallback page. Your device login request however succeeded.",
109 http.StatusOK,
110 config.KeyDeviceDoneURL,
111 ))
112 public.GET(DefaultErrorPath, h.DefaultErrorHandler)
113
114 public.Handler("OPTIONS", RevocationPath, corsMiddleware(http.HandlerFunc(h.handleOptions)))
115 public.Handler("POST", RevocationPath, corsMiddleware(http.HandlerFunc(h.revokeOAuth2Token)))
116 public.Handler("OPTIONS", WellKnownPath, corsMiddleware(http.HandlerFunc(h.handleOptions)))
117 public.Handler("GET", WellKnownPath, corsMiddleware(http.HandlerFunc(h.discoverOidcConfiguration)))
118 public.Handler("OPTIONS", OauthAuthorizationServerPath, corsMiddleware(http.HandlerFunc(h.handleOptions)))
119 public.Handler("GET", OauthAuthorizationServerPath, corsMiddleware(http.HandlerFunc(h.discoverOidcConfiguration)))
120 public.Handler("OPTIONS", UserinfoPath, corsMiddleware(http.HandlerFunc(h.handleOptions)))
121 public.Handler("GET", UserinfoPath, corsMiddleware(http.HandlerFunc(h.getOidcUserInfo)))
122 public.Handler("POST", UserinfoPath, corsMiddleware(http.HandlerFunc(h.getOidcUserInfo)))
123
124 public.Handler("OPTIONS", VerifiableCredentialsPath, corsMiddleware(http.HandlerFunc(h.handleOptions)))
125 public.Handler("POST", VerifiableCredentialsPath, corsMiddleware(http.HandlerFunc(h.createVerifiableCredential)))
126
127 public.POST(DeviceAuthPath, h.oAuth2DeviceFlow)
128 public.GET(DeviceVerificationPath, h.performOAuth2DeviceVerificationFlow)
129}
130
131func (h *Handler) SetAdminRoutes(admin *httprouterx.RouterAdmin) {
132 admin.POST(IntrospectPath, h.introspectOAuth2Token)

Callers 7

TestRevokeFunction · 0.95
TestHandlerConsentFunction · 0.95
TestHandlerDeleteHandlerFunction · 0.95
TestUserinfoFunction · 0.95
TestHandlerWellKnownFunction · 0.95

Calls 4

fallbackHandlerMethod · 0.95
HandlerMethod · 0.65
GETMethod · 0.65
POSTMethod · 0.65

Tested by 7

TestRevokeFunction · 0.76
TestHandlerConsentFunction · 0.76
TestHandlerDeleteHandlerFunction · 0.76
TestUserinfoFunction · 0.76
TestHandlerWellKnownFunction · 0.76