-1

在我的 Web 服务项目中,我需要包含使用单点登录和 spring 的身份验证部分。我是这项技术的新手。过去几天我一直在寻找示例应用程序,但找不到。请通过建议任何教程来帮助我。对我会有很大帮助

4

1 回答 1

0

对于单点登录,用于验证的 Web 服务方法应将用户名和密码作为参数,并且此验证方法应返回 MAC('Message Authentication Code',也称为'Authentication Token')。

对其他 Web 服务方法的所有后续调用都应包含此 MAC,以便 Web 服务方法知道哪个用户正在调用它们。

//example pseudo code for authentication
string web_service_auth(string User_Name,string Password) {
   ...
   string Mac;
   if (access_accepted(User_Name,Password))
     Mac = ...;
   else
     Mac = "access-denied";
   return Mac;
}

//example pseudo code for other methods
string web_service_get_my_info(string Mac) {
  if (!mac_is_valid(Mac))
    return "invalid-mac";
  ...
  string User_Name = mac_to_username(Mac);
  string Info      = get_user_info(User_Name);
  return Info;
}
于 2012-10-18T05:59:57.023 回答