Skip to content

Commit c6988d8

Browse files
Fix SQL Server connection with removing username/secret (#661)
## Description Enable Managed Identity authentication on Azure by doing the following: - Updated DB Connection String - Move redundant username/password from basic env yml to specific envs <!-- A few words to explain your changes --> ### Linked GitHub issue ID: # ## Pull Request Checklist <!-- Put an x in the boxes that apply. This is simply a reminder of what we are going to look for before merging your code. --> - [X] Tests for the changes have been added (for bug fixes / features) - [ ] Code compiles correctly with all tests are passed. - [ ] I've read the [contributing guide](https://github.com/microsoft/HydraLab/blob/main/CONTRIBUTING.md#making-changes-to-the-code) and followed the recommended practices. - [ ] [Wikis](https://github.com/microsoft/HydraLab/wiki) or [README](https://github.com/microsoft/HydraLab/blob/main/README.md) have been reviewed and added / updated if needed (for bug fixes / features) ### Does this introduce a breaking change? *If this introduces a breaking change for Hydra Lab users, please describe the impact and migration path.* - [ ] Yes - [X] No ## How you tested it *Please make sure the change is tested, you can test it by adding UTs, do local test and share the screenshots, etc.* Tested locally with local account, allocating the same permissions in DB and run the app without error. Please check the type of change your PR introduces: - [ ] Bugfix - [ ] Feature - [ ] Technical design - [ ] Build related changes - [X] Refactoring (no functional changes, no api changes) - [ ] Code style update (formatting, renaming) or Documentation content changes - [ ] Other (please describe): ### Feature UI screenshots or Technical design diagrams *If this is a relatively large or complex change, kick it off by drawing the tech design with PlantUML and explaining why you chose the solution you did and what alternatives you considered, etc...* --------- Co-authored-by: MaX ES Bot <[email protected]>
1 parent 4dc5eb4 commit c6988d8

File tree

7 files changed

+21
-12
lines changed

7 files changed

+21
-12
lines changed

center/application-sample.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ spring:
1818
redirect-uri: ${MICROSOFT_RERIRECT_URL}
1919
ignore-uri: '/api/auth,/agent/connect'
2020
scope: 'https://graph.microsoft.com/User.Read'
21-
21+
spring:
22+
datasource:
23+
url: jdbc:sqlite:${app.location}/hydra_lab_center_db.sqlite
24+
driver-class-name: org.sqlite.JDBC
25+
username: sqlite
26+
password: 98765432
2227
app:
2328
# Mail Address Format
2429
default-user: ${DEFAULT_USER}

center/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ dependencies {
4747

4848
compile group: 'org.apache.commons', name: 'commons-pool2', version: '2.7.0'
4949

50-
compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '7.4.0.jre8'
50+
compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '12.6.1.jre8'
5151
// compile group: 'org.postgresql', name: 'postgresql', version: '42.2.14'
5252

5353
compile group: 'org.springframework.security', name: 'spring-security-oauth2-client', version: '5.2.2.RELEASE'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
spring:
22
datasource:
33
url: jdbc:sqlite:${app.location}/hydra_lab_center_docker_db.sqlite
4+
driver-class-name: org.sqlite.JDBC
5+
username: sqlite
6+
password: 98765432
47

58
app:
69
location: /hydra/data

center/src/main/resources/application-release.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ spring:
1717
authorization-grant-type: authorization_code
1818
redirect-uri: ${MICROSOFT_RERIRECT_URL}
1919
ignore-uri: '/api/auth,/agent/connect'
20-
scope: 'https://graph.microsoft.com/User.Read'
20+
scope: ${MICROSOFT_AUTH_SCOPE:openid+profile+email}
2121
datasource:
22-
url: ${DB_URL}
22+
url: ${DB_URL} # UAMI integrated only
2323
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
24-
username: ${DB_NAME}
25-
password: ${DB_PASS}
2624
jpa:
2725
database-platform: org.hibernate.dialect.SQLServer2012Dialect
2826
show-sql: false

center/src/main/resources/application-test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
app:
22
default-user: '[email protected]'
33

4+
spring:
5+
datasource:
6+
url: jdbc:sqlite:${app.location}/hydra_lab_center_db.sqlite
7+
driver-class-name: org.sqlite.JDBC
8+
username: sqlite
9+
password: 98765432
10+
411
management:
512
metrics:
613
export:

center/src/main/resources/application.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ spring:
1717
multipart:
1818
max-file-size: 1024MB
1919
max-request-size: 2048MB
20-
datasource:
21-
url: jdbc:sqlite:${app.location}/hydra_lab_center_db.sqlite
22-
username: sqlite
23-
password: 98765432
24-
driver-class-name: org.sqlite.JDBC
2520
jpa:
2621
database-platform: org.sqlite.hibernate.dialect.SQLiteDialect
2722
show-sql: false

common/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ dependencies {
6767
compile group: 'org.jsoup', name: 'jsoup', version: '1.10.1'
6868
// https://docs.microsoft.com/en-us/graph/sdks/sdk-installation?context=graph%2Fapi%2F1.0&view=graph-rest-1.0
6969
compile 'com.microsoft.graph:microsoft-graph:5.4.0'
70-
implementation 'com.azure:azure-identity:1.13.0'
70+
compile 'com.azure:azure-identity:1.11.1'
71+
compile 'com.azure:azure-identity-broker:1.1.2'
7172
//blob storage
7273
compile 'com.azure:azure-storage-blob:12.23.0'
7374
//Apk analysis

0 commit comments

Comments
 (0)