Use a more general term 'entity' instead of 'datasource'

This commit is contained in:
Prasad Wagle 2016-05-21 16:00:08 -07:00
parent cbbb5916e7
commit c628099cb9
4 changed files with 14 additions and 16 deletions

View file

@ -30,12 +30,12 @@ public class UserCredentials {
this.userCredentials = new HashMap<>();
}
public UsernamePassword getUsernamePassword(String dataSource) {
return userCredentials.get(dataSource);
public UsernamePassword getUsernamePassword(String entity) {
return userCredentials.get(entity);
}
public void putUsernamePassword(String dataSource, UsernamePassword up) {
userCredentials.put(dataSource, up);
public void putUsernamePassword(String entity, UsernamePassword up) {
userCredentials.put(entity, up);
}
@Override

View file

@ -64,13 +64,13 @@ public class CredentialRestApi {
public Response putCredentials(String message) throws IOException {
Map<String, String> messageMap = gson.fromJson(message,
new TypeToken<Map<String, String>>(){}.getType());
String datasource = messageMap.get("datasource");
String entity = messageMap.get("entity");
String username = messageMap.get("username");
String password = messageMap.get("password");
String user = SecurityUtils.getPrincipal();
logger.info("Update credentials for user {} datasource {}", user, datasource);
logger.info("Update credentials for user {} entity {}", user, entity);
UserCredentials uc = credentials.getUserCredentials(user);
uc.putUsernamePassword(datasource, new UsernamePassword(username, password));
uc.putUsernamePassword(entity, new UsernamePassword(username, password));
credentials.putUserCredentials(user, uc);
return new JsonResponse(Status.OK, "", "").build();
}

View file

@ -20,13 +20,13 @@ angular.module('zeppelinWebApp').controller('CredentialCtrl', function($scope, $
$scope.updateCredentials = function() {
$http.put(baseUrlSrv.getRestApiBase() + '/credential',
{ 'datasource': $scope.dataSource,
{ 'entity': $scope.credentialEntity,
'username': $scope.credentialUsername,
'password': $scope.credentialPassword
} ).
success(function (data, status, headers, config) {
alert('Successfully saved credentials');
$scope.dataSource = '';
$scope.credentialEntity = '';
$scope.credentialUsername = '';
$scope.credentialPassword = '';
console.log('Success %o %o', status, data.message);

View file

@ -22,9 +22,7 @@ limitations under the License.
</div>
<div class="row">
<div class="col-md-12">
Add credentials for a data source one at a time.<br>
For security reasons, the credentials have to stay in memory and cannot be saved to disk.
Users will have to re-enter their credentials when the Zeppelin server is restarted.
Add credentials for entities one at a time.<br>
</div>
</div>
</div>
@ -38,15 +36,15 @@ limitations under the License.
<table class="table table-striped">
<thead>
<tr>
<th style="width:30%">Data Source</th>
<th>username</th>
<th>password</th>
<th style="width:30%">Entity</th>
<th>Username</th>
<th>Password</th>
<th ng-if="valueform.$visible">action</th>
</tr>
</thead>
<tr>
<td>
<textarea msd-elastic ng-model="dataSource"></textarea>
<textarea msd-elastic ng-model="credentialEntity"></textarea>
</td>
<td>
<textarea msd-elastic ng-model="credentialUsername"></textarea>