Skip to content

Commit

Permalink
Remove 'OPENAPI_CLIENT_ID'
Browse files Browse the repository at this point in the history
This is not needed, we can simply log into our backend instead
  • Loading branch information
GodVenn committed Mar 8, 2023
1 parent 059dfb6 commit bf5ecb1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
13 changes: 6 additions & 7 deletions src/isar/apis/api.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import logging
import os
from http import HTTPStatus
from logging import Logger
import os
from typing import List, Union

import click
import uvicorn
from fastapi import FastAPI, Security, Request
from fastapi import FastAPI, Request, Security
from fastapi.middleware.cors import CORSMiddleware
from fastapi.routing import APIRouter
from injector import inject
from pydantic import AnyHttpUrl

from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.attributes_helper import COMMON_ATTRIBUTES
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.trace.span import SpanKind
from opencensus.trace.attributes_helper import COMMON_ATTRIBUTES
from opencensus.trace.tracer import Tracer
from pydantic import AnyHttpUrl

from isar.apis.models.models import ControlMissionResponse, StartMissionResponse
from isar.apis.schedule.scheduling_controller import SchedulingController
Expand Down Expand Up @@ -76,7 +75,7 @@ def _create_app(self) -> FastAPI:
swagger_ui_oauth2_redirect_url="/oauth2-redirect",
swagger_ui_init_oauth={
"usePkceWithAuthorizationCodeGrant": True,
"clientId": self.authenticator.openapi_client_id,
"clientId": settings.AZURE_CLIENT_ID,
},
)

Expand Down
2 changes: 0 additions & 2 deletions src/isar/apis/security/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ async def validate_has_role(user: User = Depends(azure_scheme)) -> None:
class Authenticator:
def __init__(
self,
openapi_client_id: str = settings.OPENAPI_CLIENT_ID,
authentication_enabled: bool = settings.AUTHENTICATION_ENABLED,
) -> None:
self.logger = logging.getLogger("api")
self.openapi_client_id: str = openapi_client_id
self.authentication_enabled: bool = authentication_enabled
enabled_string = "enabled" if self.authentication_enabled else "disabled"
self.logger.info(f"API authentication is {enabled_string}")
Expand Down
3 changes: 0 additions & 3 deletions src/isar/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ class Settings(BaseSettings):
print("Using environment variable for AZURE_CLIENT_ID")
AZURE_CLIENT_ID = os.environ[azure_client_id_name]

# Client ID for the OpenAPI client
OPENAPI_CLIENT_ID: str = Field(default="5f412c20-8c36-4c69-898f-d2b5051f5fb6")

# MQTT username
# The username and password is set by the MQTT broker and must be known in advance
# The password should be set as an environment variable "MQTT_PASSWORD"
Expand Down

0 comments on commit bf5ecb1

Please sign in to comment.