@@ -100,11 +100,28 @@ async def lifespan(app: FastAPI):
100
100
extension = TiTilerExtension ()
101
101
extension .register (api .app , tiles_settings .titiler_endpoint )
102
102
103
+ for (method , path ), scopes in {
104
+ ("POST" , "/collections" ): ["stac:collection:create" ],
105
+ ("PUT" , "/collections" ): ["stac:collection:update" ],
106
+ ("DELETE" , "/collections/{collection_id}" ): ["stac:collection:delete" ],
107
+ ("POST" , "/collections/{collection_id}/items" ): ["stac:item:create" ],
108
+ ("PUT" , "/collections/{collection_id}/items/{item_id}" ): ["stac:item:update" ],
109
+ ("DELETE" , "/collections/{collection_id}/items/{item_id}" ): ["stac:item:delete" ],
110
+ }.items ():
111
+ api .add_route_dependencies (
112
+ [
113
+ {
114
+ "path" : app .router .prefix + path ,
115
+ "method" : method ,
116
+ "type" : "http" ,
117
+ },
118
+ ],
119
+ [Security (keycloak .scheme , scopes = scopes )],
120
+ )
121
+
103
122
104
123
@app .get ("/index.html" , response_class = HTMLResponse )
105
- async def viewer_page (
106
- request : Request , token : Annotated [str , Security (keycloak .scheme )]
107
- ):
124
+ async def viewer_page (request : Request ):
108
125
"""Search viewer."""
109
126
return templates .TemplateResponse (
110
127
"stac-viewer.html" ,
0 commit comments