Skip to content

Commit a9b73f9

Browse files
committed
Use custom controller for discovery
1 parent 42e7429 commit a9b73f9

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
class CustomDiscoveryController < ::ApplicationController
4+
def show
5+
render nothing: true
6+
end
7+
end

spec/routing/custom_controller_routes_spec.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
controllers authorizations: "custom_authorizations",
1717
tokens: "custom_authorizations",
1818
applications: "custom_authorizations",
19-
token_info: "custom_authorizations"
19+
token_info: "custom_authorizations",
20+
discovery: "custom_discovery"
2021

2122
as authorizations: "custom_auth",
2223
tokens: "custom_token",
@@ -29,7 +30,8 @@
2930
controllers authorizations: "custom_authorizations",
3031
tokens: "custom_authorizations",
3132
applications: "custom_authorizations",
32-
token_info: "custom_authorizations"
33+
token_info: "custom_authorizations",
34+
discovery: "custom_discovery"
3335

3436
as authorizations: "custom_auth",
3537
tokens: "custom_token",
@@ -41,7 +43,8 @@
4143
use_doorkeeper do
4244
controllers authorizations: "custom_authorizations",
4345
tokens: "custom_authorizations",
44-
token_info: "custom_authorizations"
46+
token_info: "custom_authorizations",
47+
discovery: "custom_discovery"
4548

4649
as authorizations: "custom_auth",
4750
tokens: "custom_token",
@@ -84,7 +87,7 @@
8487
end
8588

8689
it "GET /inner_space/.well-known/oauth-authorization-server route to show Discovery controller" do
87-
expect(get("/space/.well-known/oauth-authorization-server")).to route_to("doorkeeper/discovery#show")
90+
expect(get("/space/.well-known/oauth-authorization-server")).to route_to("custom_discovery#show")
8891
end
8992

9093

@@ -121,7 +124,7 @@
121124
end
122125

123126
it "GET /space/.well-known/oauth-authorization-server route to show Discovery controller" do
124-
expect(get("/space/.well-known/oauth-authorization-server")).to route_to("doorkeeper/discovery#show")
127+
expect(get("/space/.well-known/oauth-authorization-server")).to route_to("custom_discovery#show")
125128
end
126129

127130
it "POST /outer_space/oauth/token is not be routable" do
@@ -141,6 +144,6 @@
141144
end
142145

143146
it "GET /outer_space/.well-known/oauth-authorization-server route to show Discovery controller" do
144-
expect(get("/outer_space/.well-known/oauth-authorization-server")).to route_to("doorkeeper/discovery#show")
147+
expect(get("/outer_space/.well-known/oauth-authorization-server")).to route_to("custom_discovery#show")
145148
end
146149
end

0 commit comments

Comments
 (0)