You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2020/01/09 20:10:50 UTC

[incubator-teaclave] branch develop updated: [services] Rename service from authorization to authentication

This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git


The following commit(s) were added to refs/heads/develop by this push:
     new aa6c8b2  [services] Rename service from authorization to authentication
aa6c8b2 is described below

commit aa6c8b206088d6cdcad9c0d2c35b85787a1cc9cc
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Thu Jan 9 11:47:34 2020 -0800

    [services] Rename service from authorization to authentication
---
 cmake/tomls/Cargo.sgx_trusted_lib.toml             |  2 +-
 cmake/tomls/Cargo.sgx_untrusted_app.toml           |  2 +-
 config/runtime.config.toml                         |  2 +-
 config/src/lib.rs                                  |  2 +-
 .../app/Cargo.toml                                 |  4 ++--
 .../{authorization => authentication}/app/build.rs |  0
 .../app/src/main.rs                                |  2 +-
 .../enclave/Cargo.toml                             |  6 ++---
 .../enclave/Enclave.config.xml                     |  0
 .../enclave/src/lib.rs                             | 10 ++++-----
 .../enclave/src/service.rs                         | 26 +++++++++++-----------
 services/proto/build.rs                            |  2 +-
 services/proto/src/lib.rs                          |  2 +-
 ...proto => teaclave_authentication_service.proto} |  4 ++--
 ...rvice.rs => teaclave_authentication_service.rs} |  8 +++----
 testsuite/enclave_unit_test/enclave/Cargo.toml     |  6 ++---
 testsuite/enclave_unit_test/enclave/src/lib.rs     |  4 ++--
 .../service_functional_test/enclave/src/lib.rs     |  4 ++--
 ...rvice.rs => teaclave_authentication_service.rs} | 10 ++++-----
 utils/service_config/src/external.rs               |  4 ++--
 20 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/cmake/tomls/Cargo.sgx_trusted_lib.toml b/cmake/tomls/Cargo.sgx_trusted_lib.toml
index 80c4d33..1444986 100644
--- a/cmake/tomls/Cargo.sgx_trusted_lib.toml
+++ b/cmake/tomls/Cargo.sgx_trusted_lib.toml
@@ -1,7 +1,7 @@
 [workspace]
 
 members = [
-  "services/authorization/enclave",
+  "services/authentication/enclave",
   "testsuite/enclave_unit_test/enclave",
   "testsuite/service_functional_test/enclave",
 ]
diff --git a/cmake/tomls/Cargo.sgx_untrusted_app.toml b/cmake/tomls/Cargo.sgx_untrusted_app.toml
index fa4a5fb..34615bb 100644
--- a/cmake/tomls/Cargo.sgx_untrusted_app.toml
+++ b/cmake/tomls/Cargo.sgx_untrusted_app.toml
@@ -1,7 +1,7 @@
 [workspace]
 
 members = [
-  "services/authorization/app",
+  "services/authentication/app",
   "testsuite/enclave_unit_test/app",
   "testsuite/service_functional_test/app",
 ]
diff --git a/config/runtime.config.toml b/config/runtime.config.toml
index cd3f1fb..18beff8 100644
--- a/config/runtime.config.toml
+++ b/config/runtime.config.toml
@@ -28,7 +28,7 @@
 #      └───────────────────────────────────────────────────┘
 
 [api_endpoints]
-authorization = { listen_address = "0.0.0.0:7776" }
+authentication = { listen_address = "0.0.0.0:7776" }
 frontend      = { listen_address = "0.0.0.0:7777" }
 tms  = { listen_address = "0.0.0.0:5554" }
 tdfs = { listen_address = "0.0.0.0:5065" }
diff --git a/config/src/lib.rs b/config/src/lib.rs
index a024d79..c198cb9 100644
--- a/config/src/lib.rs
+++ b/config/src/lib.rs
@@ -42,7 +42,7 @@ pub mod runtime_config {
     #[derive(Debug, Deserialize)]
     pub struct ApiEndpointsConfig {
         pub frontend: EndpointListenConfig,
-        pub authorization: EndpointListenConfig,
+        pub authentication: EndpointListenConfig,
         pub tms: EndpointListenConfig,
         pub tdfs: EndpointListenConfig,
         pub fns: EndpointListenAdvertisedConfig,
diff --git a/services/authorization/app/Cargo.toml b/services/authentication/app/Cargo.toml
similarity index 86%
rename from services/authorization/app/Cargo.toml
rename to services/authentication/app/Cargo.toml
index 57e2d68..d320558 100644
--- a/services/authorization/app/Cargo.toml
+++ b/services/authentication/app/Cargo.toml
@@ -1,8 +1,8 @@
 [package]
-name = "teaclave_authorization_service"
+name = "teaclave_authentication_service"
 version = "0.1.0"
 authors = ["Teaclave Contributors <de...@teaclave.apache.org>"]
-description = "Teaclave Authorization Service"
+description = "Teaclave Authentication Service"
 license = "Apache-2.0"
 build = "build.rs"
 edition = "2018"
diff --git a/services/authorization/app/build.rs b/services/authentication/app/build.rs
similarity index 100%
rename from services/authorization/app/build.rs
rename to services/authentication/app/build.rs
diff --git a/services/authorization/app/src/main.rs b/services/authentication/app/src/main.rs
similarity index 96%
rename from services/authorization/app/src/main.rs
rename to services/authentication/app/src/main.rs
index 0664617..7bf7482 100644
--- a/services/authorization/app/src/main.rs
+++ b/services/authentication/app/src/main.rs
@@ -39,7 +39,7 @@ fn main() -> anyhow::Result<()> {
 
 fn start_enclave_service(tee: Arc<TeeBinder>) -> anyhow::Result<()> {
     info!("Start enclave service");
-    let config = teaclave_service_config::External::authorization();
+    let config = teaclave_service_config::External::authentication();
     let listener = TcpListener::bind(config.addr)?;
     let fd = listener.into_raw_fd();
     let input = StartServiceInput { fd };
diff --git a/services/authorization/enclave/Cargo.toml b/services/authentication/enclave/Cargo.toml
similarity index 90%
rename from services/authorization/enclave/Cargo.toml
rename to services/authentication/enclave/Cargo.toml
index 06f4241..4e863e2 100644
--- a/services/authorization/enclave/Cargo.toml
+++ b/services/authentication/enclave/Cargo.toml
@@ -1,13 +1,13 @@
 [package]
-name = "teaclave_authorization_service_enclave"
+name = "teaclave_authentication_service_enclave"
 version = "0.1.0"
 authors = ["Teaclave Contributors <de...@teaclave.apache.org>"]
-description = "Teaclave Authorization Service enclave"
+description = "Teaclave Authentication Service enclave"
 license = "Apache-2.0"
 edition = "2018"
 
 [lib]
-name = "teaclave_authorization_service_enclave"
+name = "teaclave_authentication_service_enclave"
 crate-type = ["staticlib", "rlib"]
 
 [features]
diff --git a/services/authorization/enclave/Enclave.config.xml b/services/authentication/enclave/Enclave.config.xml
similarity index 100%
rename from services/authorization/enclave/Enclave.config.xml
rename to services/authentication/enclave/Enclave.config.xml
diff --git a/services/authorization/enclave/src/lib.rs b/services/authentication/enclave/src/lib.rs
similarity index 92%
rename from services/authorization/enclave/src/lib.rs
rename to services/authentication/enclave/src/lib.rs
index 26cd646..e8bf5de 100644
--- a/services/authorization/enclave/src/lib.rs
+++ b/services/authentication/enclave/src/lib.rs
@@ -38,8 +38,8 @@ use teaclave_service_config as config;
 use teaclave_service_enclave_utils::ServiceEnclave;
 
 use teaclave_attestation::RemoteAttestation;
-use teaclave_proto::teaclave_authorization_service::{
-    TeaclaveAuthorizationRequest, TeaclaveAuthorizationResponse,
+use teaclave_proto::teaclave_authentication_service::{
+    TeaclaveAuthenticationRequest, TeaclaveAuthenticationResponse,
 };
 use teaclave_rpc::config::SgxTrustedTlsServerConfig;
 use teaclave_rpc::server::SgxTrustedTlsServer;
@@ -62,10 +62,10 @@ fn handle_start_service(args: &StartServiceInput) -> Result<StartServiceOutput>
     .unwrap();
 
     let mut server = SgxTrustedTlsServer::<
-        TeaclaveAuthorizationResponse,
-        TeaclaveAuthorizationRequest,
+        TeaclaveAuthenticationResponse,
+        TeaclaveAuthenticationRequest,
     >::new(listener, &config);
-    match server.start(service::TeaclaveAuthorizationService) {
+    match server.start(service::TeaclaveAuthenticationService) {
         Ok(_) => (),
         Err(e) => {
             error!("Service exit, error: {}.", e);
diff --git a/services/authorization/enclave/src/service.rs b/services/authentication/enclave/src/service.rs
similarity index 63%
rename from services/authorization/enclave/src/service.rs
rename to services/authentication/enclave/src/service.rs
index 44a3252..206842c 100644
--- a/services/authorization/enclave/src/service.rs
+++ b/services/authentication/enclave/src/service.rs
@@ -1,37 +1,37 @@
 use std::prelude::v1::*;
-use teaclave_proto::teaclave_authorization_service::{
-    self, TeaclaveAuthorization, UserLoginRequest, UserLoginResponse,
+use teaclave_proto::teaclave_authentication_service::{
+    self, TeaclaveAuthentication, UserLoginRequest, UserLoginResponse,
 };
 use teaclave_service_enclave_utils::teaclave_service;
 use teaclave_types::{TeaclaveServiceResponseError, TeaclaveServiceResponseResult};
 use thiserror::Error;
 
 #[derive(Error, Debug)]
-pub enum TeaclaveAuthorizationError {
+pub enum TeaclaveAuthenticationError {
     #[error("permission denied")]
     PermissionDenied,
 }
 
-impl From<TeaclaveAuthorizationError> for TeaclaveServiceResponseError {
-    fn from(error: TeaclaveAuthorizationError) -> Self {
+impl From<TeaclaveAuthenticationError> for TeaclaveServiceResponseError {
+    fn from(error: TeaclaveAuthenticationError) -> Self {
         TeaclaveServiceResponseError::RequestError(error.to_string())
     }
 }
 
 #[teaclave_service(
-    teaclave_authorization_service,
-    TeaclaveAuthorization,
-    TeaclaveAuthorizationError
+    teaclave_authentication_service,
+    TeaclaveAuthentication,
+    TeaclaveAuthenticationError
 )]
 #[derive(Copy, Clone)]
-pub(crate) struct TeaclaveAuthorizationService;
+pub(crate) struct TeaclaveAuthenticationService;
 
-impl TeaclaveAuthorization for TeaclaveAuthorizationService {
+impl TeaclaveAuthentication for TeaclaveAuthenticationService {
     fn user_login(_request: UserLoginRequest) -> TeaclaveServiceResponseResult<UserLoginResponse> {
         #[cfg(test_mode)]
         return test_mode::mock_user_login(_request);
 
-        Err(TeaclaveAuthorizationError::PermissionDenied.into())
+        Err(TeaclaveAuthenticationError::PermissionDenied.into())
     }
 }
 
@@ -47,7 +47,7 @@ mod test_mode {
             };
             return Ok(response);
         }
-        Err(TeaclaveAuthorizationError::PermissionDenied.into())
+        Err(TeaclaveAuthenticationError::PermissionDenied.into())
     }
 }
 
@@ -60,6 +60,6 @@ pub mod tests {
             id: "test_id".to_string(),
             password: "test_password".to_string(),
         };
-        assert!(TeaclaveAuthorizationService::user_login(request).is_ok());
+        assert!(TeaclaveAuthenticationService::user_login(request).is_ok());
     }
 }
diff --git a/services/proto/build.rs b/services/proto/build.rs
index 5c52934..e99d504 100644
--- a/services/proto/build.rs
+++ b/services/proto/build.rs
@@ -34,7 +34,7 @@ fn main() {
             "./proto_gen/Cargo.toml",
             "--",
             "-p",
-            "src/proto/teaclave_authorization_service.proto",
+            "src/proto/teaclave_authentication_service.proto",
             "-i",
             "src/proto",
             "-d",
diff --git a/services/proto/src/lib.rs b/services/proto/src/lib.rs
index a040144..2c08f82 100644
--- a/services/proto/src/lib.rs
+++ b/services/proto/src/lib.rs
@@ -19,4 +19,4 @@
 #[cfg(feature = "mesalock_sgx")]
 extern crate sgx_tstd as std;
 
-pub mod teaclave_authorization_service;
+pub mod teaclave_authentication_service;
diff --git a/services/proto/src/proto/teaclave_authorization_service.proto b/services/proto/src/proto/teaclave_authentication_service.proto
similarity index 72%
rename from services/proto/src/proto/teaclave_authorization_service.proto
rename to services/proto/src/proto/teaclave_authentication_service.proto
index 8301b6d..4d26e18 100644
--- a/services/proto/src/proto/teaclave_authorization_service.proto
+++ b/services/proto/src/proto/teaclave_authentication_service.proto
@@ -1,5 +1,5 @@
 syntax = "proto3";
-package teaclave_authorization_service_proto;
+package teaclave_authentication_service_proto;
 
 message UserLoginRequest {
   string id = 1;
@@ -10,6 +10,6 @@ message UserLoginResponse {
   string token = 1;
 }
 
-service TeaclaveAuthorization {
+service TeaclaveAuthentication {
   rpc UserLogin (UserLoginRequest) returns (UserLoginResponse);
 }
diff --git a/services/proto/src/teaclave_authorization_service.rs b/services/proto/src/teaclave_authentication_service.rs
similarity index 85%
rename from services/proto/src/teaclave_authorization_service.rs
rename to services/proto/src/teaclave_authentication_service.rs
index 9a2511b..cddb914 100644
--- a/services/proto/src/teaclave_authorization_service.rs
+++ b/services/proto/src/teaclave_authentication_service.rs
@@ -4,13 +4,13 @@ pub mod proto {
     #![allow(clippy::all)]
     include!(concat!(
         env!("OUT_DIR"),
-        "/teaclave_authorization_service_proto.rs"
+        "/teaclave_authentication_service_proto.rs"
     ));
 }
 
-pub use proto::TeaclaveAuthorization;
-pub use proto::TeaclaveAuthorizationRequest;
-pub use proto::TeaclaveAuthorizationResponse;
+pub use proto::TeaclaveAuthentication;
+pub use proto::TeaclaveAuthenticationRequest;
+pub use proto::TeaclaveAuthenticationResponse;
 
 #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)]
 pub struct UserLoginRequest {
diff --git a/testsuite/enclave_unit_test/enclave/Cargo.toml b/testsuite/enclave_unit_test/enclave/Cargo.toml
index 8a598cd..89a25ef 100644
--- a/testsuite/enclave_unit_test/enclave/Cargo.toml
+++ b/testsuite/enclave_unit_test/enclave/Cargo.toml
@@ -20,8 +20,8 @@ mesalock_sgx = [
   "teaclave_service_config/mesalock_sgx",
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
-  "teaclave_authorization_service_enclave/mesalock_sgx",
-  "teaclave_authorization_service_enclave/enclave_unit_test"
+  "teaclave_authentication_service_enclave/mesalock_sgx",
+  "teaclave_authentication_service_enclave/enclave_unit_test"
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
 
@@ -31,7 +31,7 @@ anyhow      = { version = "1.0.26" }
 serde       = { version = "1.0.92" }
 thiserror   = { version = "1.0.9" }
 
-teaclave_authorization_service_enclave = { path = "../../../services/authorization/enclave" }
+teaclave_authentication_service_enclave = { path = "../../../services/authentication/enclave" }
 
 teaclave_attestation           = { path = "../../../attestation" }
 teaclave_config                = { path = "../../../config" }
diff --git a/testsuite/enclave_unit_test/enclave/src/lib.rs b/testsuite/enclave_unit_test/enclave/src/lib.rs
index 9b6d1d9..fcab4b3 100644
--- a/testsuite/enclave_unit_test/enclave/src/lib.rs
+++ b/testsuite/enclave_unit_test/enclave/src/lib.rs
@@ -27,7 +27,7 @@ use std::prelude::v1::*;
 use anyhow::Result;
 use teaclave_types;
 
-use teaclave_authorization_service_enclave;
+use teaclave_authentication_service_enclave;
 use teaclave_ipc::protos::ecall::{
     FinalizeEnclaveInput, FinalizeEnclaveOutput, InitEnclaveInput, InitEnclaveOutput,
     RunEnclaveUnitTestInput, RunEnclaveUnitTestOutput,
@@ -41,7 +41,7 @@ fn handle_run_enclave_unit_test(
     _args: &RunEnclaveUnitTestInput,
 ) -> Result<RunEnclaveUnitTestOutput> {
     let mut failed_count = 0;
-    failed_count += teaclave_authorization_service_enclave::tests::run_tests();
+    failed_count += teaclave_authentication_service_enclave::tests::run_tests();
     Ok(RunEnclaveUnitTestOutput { failed_count })
 }
 
diff --git a/testsuite/service_functional_test/enclave/src/lib.rs b/testsuite/service_functional_test/enclave/src/lib.rs
index a0e7932..de8fe49 100644
--- a/testsuite/service_functional_test/enclave/src/lib.rs
+++ b/testsuite/service_functional_test/enclave/src/lib.rs
@@ -35,13 +35,13 @@ use teaclave_ipc::protos::ECallCommand;
 use teaclave_ipc::{handle_ecall, register_ecall_handler};
 use teaclave_service_enclave_utils::ServiceEnclave;
 
-mod teaclave_authorization_service;
+mod teaclave_authentication_service;
 
 #[handle_ecall]
 fn handle_run_enclave_unit_test(
     _args: &RunServiceFunctionalTestInput,
 ) -> Result<RunServiceFunctionalTestOutput> {
-    teaclave_authorization_service::run_functional_tests();
+    teaclave_authentication_service::run_functional_tests();
 
     Ok(RunServiceFunctionalTestOutput::default())
 }
diff --git a/testsuite/service_functional_test/enclave/src/teaclave_authorization_service.rs b/testsuite/service_functional_test/enclave/src/teaclave_authentication_service.rs
similarity index 79%
rename from testsuite/service_functional_test/enclave/src/teaclave_authorization_service.rs
rename to testsuite/service_functional_test/enclave/src/teaclave_authentication_service.rs
index 8d8f7ae..9b73b59 100644
--- a/testsuite/service_functional_test/enclave/src/teaclave_authorization_service.rs
+++ b/testsuite/service_functional_test/enclave/src/teaclave_authentication_service.rs
@@ -1,12 +1,12 @@
 use sgx_tunittest::*;
 use std::prelude::v1::*;
-use teaclave_proto::teaclave_authorization_service::proto::*;
+use teaclave_proto::teaclave_authentication_service::proto::*;
 use teaclave_rpc::channel::SgxTrustedTlsChannel;
 use teaclave_rpc::config::SgxTrustedTlsClientConfig;
 use teaclave_types::TeaclaveServiceResponseResult;
 
-type U = TeaclaveAuthorizationRequest;
-type V = TeaclaveServiceResponseResult<TeaclaveAuthorizationResponse>;
+type U = TeaclaveAuthenticationRequest;
+type V = TeaclaveServiceResponseResult<TeaclaveAuthenticationResponse>;
 
 pub fn run_functional_tests() {
     rsgx_unit_tests!(test_login_success, test_login_failed,);
@@ -16,7 +16,7 @@ fn test_login_success() {
     let client_config = SgxTrustedTlsClientConfig::new_without_verifier();
     let channel =
         SgxTrustedTlsChannel::<U, V>::new("127.0.0.1:7776", "localhost", &client_config).unwrap();
-    let mut client = TeaclaveAuthorizationClient::new(channel).unwrap();
+    let mut client = TeaclaveAuthenticationClient::new(channel).unwrap();
     let request = UserLoginRequest {
         id: "test_id".to_string(),
         password: "test_password".to_string(),
@@ -30,7 +30,7 @@ fn test_login_failed() {
     let client_config = SgxTrustedTlsClientConfig::new_without_verifier();
     let channel =
         SgxTrustedTlsChannel::<U, V>::new("127.0.0.1:7776", "localhost", &client_config).unwrap();
-    let mut client = TeaclaveAuthorizationClient::new(channel).unwrap();
+    let mut client = TeaclaveAuthenticationClient::new(channel).unwrap();
     let request = UserLoginRequest {
         id: "".to_string(),
         password: "".to_string(),
diff --git a/utils/service_config/src/external.rs b/utils/service_config/src/external.rs
index 89bba75..935e83f 100644
--- a/utils/service_config/src/external.rs
+++ b/utils/service_config/src/external.rs
@@ -28,9 +28,9 @@ impl External {
             InboundDesc::External,
         )
     }
-    pub fn authorization() -> ServiceConfig {
+    pub fn authentication() -> ServiceConfig {
         ServiceConfig::new(
-            runtime_config().api_endpoints.authorization.listen_address,
+            runtime_config().api_endpoints.authentication.listen_address,
             InboundDesc::External,
         )
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org