block some operations in oauth mode - #784
Conversation
| root.enabled = ${?EXCHANGE_ROOT_ENABLED} | ||
| root.password = ${?EXCHANGE_ROOT_PW} | ||
|
|
||
| oauth.enabled = ${?EXCHANGE_OAUTH_ENABLED} |
There was a problem hiding this comment.
As of version 2.130.0 this can now be removed.
| root.enabled = true # If set to false it will not honor the root credentials | ||
| root.password = null | ||
|
|
||
| oauth.enabled = false |
|
|
||
| validateWithMsg(reqBody.getAnyProblem) { | ||
| val timestamp: java.sql.Timestamp = ApiTime.nowUTCTimestamp | ||
| val isOAuthEnabled = Configuration.getConfig.getBoolean("api.oauth.enabled") |
There was a problem hiding this comment.
Use this:
131011c to
42e4f3a
Compare
f096f43 to
1aecb38
Compare
|
Need to update unit tests since the method to check whether OAuth is enabled has changed. Will do on Monday. |
1aecb38 to
225ab93
Compare
|
@kroczi @naphelps Please review. Some updates:
One question: Do you have any suggestions for a cleaner or more robust way to handle this? Is there anyway to unset this environment variable in the UT? |
| val oauthEnabled = Configuration.getConfig.getBoolean("api.oauth.enabled") | ||
| val oauthEnabled = Configuration.getConfig.hasPath("api.authentication.oauth.provider.user_info.url") |
There was a problem hiding this comment.
This needs to be removed "api.oauth.enabled" from .conf files.
| updateConfig("api.oauth.enabled", "true") | ||
| updateConfig("api.authentication.oauth.provider.user_info.url", "http://localhost:8080/mock-oauth") |
There was a problem hiding this comment.
I think "api.oauth.enabled" approach was cleaner, but if that is the new setup then ok.
76c9879 to
e870043
Compare
Signed-off-by: wenyang-cao <wenyang.cao@ibm.com>
e870043 to
dfe81b6
Compare
references: #782 #783
The Put Users route must only update user records, not create new users on the system when OAuth is configured.
Passwords should not work for non-locally provided accounts. User -> Provider != Open Horizon. Affects Put and Patch User routes, and the change-password route. This is only when OAuth is configured.
Better view with: https://github.com/open-horizon/exchange-api/pull/784/files?w=1
Haven't updated changelog since I am not sure what version it would be when it is ready to be merged. I personally feel that issues #783 #782 #781 can be kept in a same version.
@naphelps @kroczi