Commit 3e33429a authored by Muhammad Umair Zafar's avatar Muhammad Umair Zafar
Browse files

add OAuth security feature in the API-driven sandbox

parent fc20d03d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -32,6 +32,15 @@ image:
  env:
    MEEP_SVC_PATH: /sandbox-api/v1
  envSecret:
    MEEP_SESSION_KEY:
      name: meep-session
      key: encryption-key
    MEEP_OAUTH_GITHUB_CLIENT_ID:
      name: meep-oauth-github
      key: client-id
    # MEEP_OAUTH_GITHUB_SECRET:
    #   name: meep-oauth-github
    #   key: secret

service:
  type: ClusterIP
+9 −7
Original line number Diff line number Diff line
curl --verbose --request POST https://mec-platform.etsi.org/sandbox-api/v1/login?provider=gitlab --header "Accept: application/json"
curl -X POST "http://192.168.10.42/sandbox-api/v1/login?provider=github" --header "Accept: application/json"

curl --verbose --request GET https://mec-platform.etsi.org/sandbox-api/v1/sandboxNetworkScenarios --header "Accept: application/json"
curl -X GET "http://192.168.10.42/sandbox-api/v1/namespace?user_code=D87E-179D" --header "Accept: application/json"

curl --verbose --request GET https://mec-platform.etsi.org/sandbox-api/v1/sandboxNetworkScenarios/4g-5g-macro-v2x --header "Accept: application/json"
curl -X GET http://192.168.10.42/sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbx2bplfsb --header "Accept: application/json"

curl --verbose --request POST https://mec-platform.etsi.org/sandbox-api/v1/sandboxNetworkScenarios/4g-5g-macro-v2x?sandbox_name=sbx5zg770k --header "Accept: application/json"
curl -X GET "http://192.168.10.42/sandbox-api/v1/sandboxNetworkScenarios/sbx2bplfsb?network_scenario_id=4g-5g-macro-v2x" --header "Accept: application/json"

curl --verbose --request GET https://mec-platform.etsi.org/sandbox-api/v1/sandboxMecServices?sandbox_name=sbx5zg770k --header "Accept: application/json"
curl -X POST "http://192.168.10.42/sandbox-api/v1/sandboxNetworkScenarios/sbx2bplfsb?network_scenario_id=4g-5g-macro-v2x" --header "Accept: application/json"

curl --verbose --request DELETE https://mec-platform.etsi.org/sandbox-api/v1/sandboxNetworkScenarios/4g-5g-macro-v2x?sandbox_name=sbx5zg770k --header "Accept: application/json"
curl -X GET "http://192.168.10.42/sandbox-api/v1/sandboxMecServices/sbx2bplfsb" --header "Accept: application/json"

curl --verbose --request POST https://mec-platform.etsi.org/sandbox-api/v1/logout?sandbox_name=sbxj3a7sld --header "Accept: application/json"
curl -X DELETE http://192.168.10.42/sandbox-api/v1/sandboxNetworkScenarios/sbx2bplfsb/4g-5g-macro-v2x

curl -X POST http://192.168.10.42/sandbox-api/v1/logout?sandbox_name=sbx2bplfsb --header "Accept: application/json"

kubectl logs meep-auth-svc-5b68d569d8-mzfcs > meep-auth-svc.log 2>&1
kubectl logs meep-sandbox-api-6f497778b5-g5qsv > meep-sandbox-api.log 2>&1
 No newline at end of file
+30 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ info:
  license:
    name: BSD-3-Clause
    url: https://forge.etsi.org/legal-matters
  version: 0.0.7
  version: 0.0.8
servers:
- url: http://localhost/sandbox-api/v1
paths:
@@ -29,7 +29,6 @@ paths:
          type: string
          enum:
          - GITHUB
          - GITLAB (EOL ACCOUNT)
      responses:
        "201":
          description: Created
@@ -46,6 +45,35 @@ paths:
        "404":
          description: Not Found
          content: {}
  /namespace:
    get:
      tags:
      - Authorization
      summary: Get the namespace against the User Code
      description: Get the namespace against the User Code
      operationId: GetNamespace
      parameters:
      - name: user_code
        in: query
        description: User Code obtained from the login endpoint
        required: true
        style: form
        explode: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content: {}
        "400":
          description: Bad Request
          content: {}
        "401":
          description: Unauthorized
          content: {}
        "404":
          description: Not Found
          content: {}
  /logout:
    post:
      tags:
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@ func Login(w http.ResponseWriter, r *http.Request) {
	login(w, r)
}

func GetNamespace(w http.ResponseWriter, r *http.Request) {
	getNamespace(w, r)
}

func Logout(w http.ResponseWriter, r *http.Request) {
	logout(w, r)
}
+7 −0
Original line number Diff line number Diff line
@@ -61,6 +61,13 @@ var routes = Routes{
		Login,
	},

	Route{
		"GetNamespace",
		strings.ToUpper("Get"),
		"/sandbox-api/v1/namespace",
		GetNamespace,
	},

	Route{
		"Logout",
		strings.ToUpper("Post"),
Loading