I try to create with angularjs based Ionic app an authentication mechanism. The system looks like this:
我尝试用基于angularjs的Ionic app创建一个认证机制。系统是这样的:
mobile users are created by administrators on the server. This created mobile user can login into the app.
移动用户是由服务器上的管理员创建的。这个创建的移动用户可以登录应用程序。
The users are stored on the server in a JSON object. I had imagined the steps as following?
用户存储在服务器上的JSON对象中。我想象的步骤是这样的?
- The link to the JSON object should be parsed.
- 应该解析到JSON对象的链接。
- The created users and passwords on the server are to be compared with the locally login data
- 服务器上创建的用户和密码将与本地登录数据进行比较
- If the user has successfully logged into the system, the user data should be stored locally.
- 如果用户成功登录到系统,那么用户数据应该存储在本地。
Edit:
编辑:
The flow of the authentication will be effected as follows:
认证流程如下:
How to create a login system like this programmatically?
如何以编程方式创建这样的登录系统?
1 个解决方案
#1
2
The steps should be
这些步骤应该
1) Send username password to server using $http.post();
1)使用$http.post()向服务器发送用户名密码;
2) Server authenticates the credentials. and returns a token in return is credentials are correct.
2)服务器验证凭证。返回一个令牌作为返回的凭证是正确的。
3) App stores this token locally and passes it to server for later request as a mean of identification of logged in user.
3) App在本地存储该令牌,并将其作为登录用户标识的一种方式传递给服务器以供以后请求。
Ideally you should implement SOAP or REST based services on your server and consume those services in your app.
理想情况下,您应该在服务器上实现基于SOAP或REST的服务,并在应用程序中使用这些服务。
#1
2
The steps should be
这些步骤应该
1) Send username password to server using $http.post();
1)使用$http.post()向服务器发送用户名密码;
2) Server authenticates the credentials. and returns a token in return is credentials are correct.
2)服务器验证凭证。返回一个令牌作为返回的凭证是正确的。
3) App stores this token locally and passes it to server for later request as a mean of identification of logged in user.
3) App在本地存储该令牌,并将其作为登录用户标识的一种方式传递给服务器以供以后请求。
Ideally you should implement SOAP or REST based services on your server and consume those services in your app.
理想情况下,您应该在服务器上实现基于SOAP或REST的服务,并在应用程序中使用这些服务。