Skip to content

Commit

Permalink
Feature/his internal profile (#2887)
Browse files Browse the repository at this point in the history
* updated local deployment instruction

* properties for internal HIS cluster

* Update application-internal.yml

deleted credentials

* logo for codehub sign in button

* Update application-internal.yml

left only properties that relates to codehub authorization

* codehub icon

* codehub logo

* deleted comments

* Update LoginUtils.kt

* deleted unnecessary lines

* return to correct version of file
  • Loading branch information
acies312 authored Dec 21, 2023
1 parent 8167211 commit 2ecbc3b
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 17 deletions.
18 changes: 18 additions & 0 deletions api-gateway/src/main/resources/application-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
spring:
security:
oauth2:
client:
provider:
codehub:
authorization-uri: https://codehub-g.huawei.com/oauth/authorize
token-uri: https://codehub-g.huawei.com/oauth/token
user-info-uri: https://codehub-g.huawei.com/api/v4/user
user-name-attribute: username
user-info-authentication-method: post
registration:
codehub:
provider: codehub
redirect-uri: '${gateway.frontend.url}/{action}/oauth2/code/{registrationId}'
authorization-grant-type: authorization_code
client-authentication-method: client_secret_post
scope: profile
16 changes: 11 additions & 5 deletions save-cloud-charts/save-cloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ command line using `--set` flag.

## Local deployment
* Install minikube: https://minikube.sigs.k8s.io/docs/start/
* install csi addon in minikube to provide this StorageClass type in your minikube cluster
```bash
minikube addons enable csi-hostpath-driver
```
* [optional] modify kube config file to use base64 encripted info about certs and keys instead of using path to cert file
```yaml
certificate-authority-data: <base64 encoded cert>
client-certificate-data: <base64 encoded cert>
client-key-data: <base64 encoded cert>
```
* Environment should be prepared:
```bash
minikube ssh
Expand All @@ -60,13 +70,9 @@ command line using `--set` flag.
build.docker.tls-verify=true
build.docker.cert-path=<path-to-user-home>/.minikube/certs
```
* (Required only once) Install Helm chart using `values-minikube.yaml`:
```bash
$ helm install save-cloud save-cloud-0.1.0.tgz --namespace save-cloud --values values-minikube.yaml <any other value files and/or --set flags>
```
* (On consecutive deployments) Upgrade an existing Helm release:
```bash
$ helm upgrade save-cloud save-cloud-0.1.0.tgz --namespace save-cloud --values values-minikube.yaml <any other value files and/or --set flags>
$ helm --kube-context=minikube --namespace=save-cloud upgrade -i save-cloud save-cloud-0.1.0.tgz/<or use ulr oci://ghcr.io/saveourtool/save-cloud> --values values-minikube.yaml --values=values-images.yaml <any other value files and/or --set flags>
```
* Database migrations can be run by setting value `mysql.migrations.enabled` to `true` (no additional setup, migrations
are executed by init container, but may be too slow with constant recreations of backend/sandbox pods)
Expand Down
25 changes: 25 additions & 0 deletions save-cloud-charts/save-cloud/values-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
chartVersion: '0.2.1+1056'

# The version from the "Build and push Docker images" action.
#
# Search the log for the "Successfully built image
# 'ghcr.io/saveourtool/api-gateway:master'" line, or simply
# look up the version of the latest published package at
# <https://github.com/orgs/saveourtool/packages?repo_name=save-cloud>.
dockerTag: '0.4.0-alpha.0.379-70423bd'
gateway:
dockerTag: '0.4.0-alpha.0.379-70423bd'
backend:
dockerTag: '0.4.0-alpha.0.379-70423bd'
frontend:
dockerTag: '0.4.0-alpha.0.379-70423bd'
preprocessor:
dockerTag: '0.4.0-alpha.0.379-70423bd'
orchestrator:
dockerTag: '0.4.0-alpha.0.379-70423bd'
sandbox:
dockerTag: '0.4.0-alpha.0.379-70423bd'
demo:
dockerTag: '0.4.0-alpha.0.379-70423bd'
demo_cpg:
dockerTag: '0.4.0-alpha.0.379-70423bd'
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

package com.saveourtool.save.frontend.common.utils

import com.saveourtool.save.frontend.common.externals.fontawesome.*
import com.saveourtool.save.frontend.common.externals.fontawesome.faCopyright
import com.saveourtool.save.frontend.common.externals.fontawesome.faSignInAlt
import com.saveourtool.save.frontend.common.externals.fontawesome.fontAwesomeIcon
import com.saveourtool.save.info.OauthProviderInfo
Expand Down Expand Up @@ -43,7 +41,7 @@ fun ChildrenBuilder.processRegistrationId(
) = oauthLoginForKnownAwesomeIcons(
oauthProvidersFeConfig,
mapKnownUploadedIcons(oauthProvidersFeConfig.provider.registrationId),
mapKnownFontAwesomeIcons(oauthProvidersFeConfig.provider.registrationId)
faSignInAlt
)

/**
Expand Down Expand Up @@ -88,15 +86,6 @@ private fun ChildrenBuilder.oauthLoginForKnownAwesomeIcons(
}
}

/**
* @param registrationId oauth provider name (same as in spring security config) from api-gateway
*/
fun mapKnownFontAwesomeIcons(registrationId: String) =
when (registrationId) {
"codehub" -> faCopyright
else -> faSignInAlt
}

/**
* Mapping ONLY for those icons that are uploaded to SAVE.
* Please note that companies like google strictly prohibits incorrect usage of sign-in buttons:
Expand All @@ -110,5 +99,6 @@ fun mapKnownUploadedIcons(registrationId: String) =
"gitee" -> "/img/gitee.svg"
"github" -> "/img/github.svg"
"google" -> "/img/google.svg"
"codehub" -> "/img/codehub.svg"
else -> ""
}
37 changes: 37 additions & 0 deletions save-frontend/src/main/resources/img/codehub.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2ecbc3b

Please sign in to comment.