zoukankan      html  css  js  c++  java
  • remoting 安全认证,密码,用户名

    服务器端: 
    namespace   RemoteServer 

          public   class   Scoop   :   MarshalByRefObject 
          { 
                public   Scoop() 
                { 
                } 

                public   string   GetTheScoop(string   name) 
                { 
                      return   "Here 's   the   scoop,   " 
                        +   Thread.CurrentPrincipal.Identity.Name   +   "! "; 
                } 
          } 

    配制文件: 
    <configuration> 
        <system.runtime.remoting> 
            <application> 
                <service> 
                    <wellknown   mode= "SingleCall "   
                        type= "RemoteServer.Scoop,RemoteServer "   
                        objectUri= "Scoop.soap "   /> 
                </service> 
            </application> 
        </system.runtime.remoting> 
        <system.web> 
            <authentication   mode= "None "   /> 
            <authorization> 
                <deny   users= "? "   /> 
            </authorization>   
        </system.web> </configuration> 

    客户端: 
    static   void   Main(string[]   args) 

          ChannelServices.RegisterChannel(new   HttpClientChannel()); 
          RemotingConfiguration.RegisterWellKnownClientType( 
              typeof(RemoteServer.Scoop), 
              "http://localhost/ScoopRemoting/Scoop.soap "); 

          Scoop   srv   =   new   Scoop(); 

          IDictionary   props   =   ChannelServices.GetChannelSinkProperties(srv); 
          props[ "username "]   =   "test "; 
          props[ "password "]   =   "test "; 

          string   s   =   srv.GetTheScoop( "Greg "); 
          Console.WriteLine(s); 


    如果这样做的话,别人写个客户端不是可以随便模仿一下登录?   
    如果限制角色: 
    <authorization> 
            <allow   role= "aaaa "   /> 
            <deny   users= "* "   /> 
    </authorization> 

    别人如果知道你的角色是什么,   也可以写个客户端模仿吧?

  • 相关阅读:
    SCM Introduction
    upper lower capitalize and title
    isinstance
    splitlines
    使用 UITableView 创建表格应用演练(4)——自定义单元格
    高性能网站的十四条黄金法则
    javascript设计模式继承(上)
    这些年,我收集的JavaScript代码(一)
    ObjectiveC语法之KVO的使用
    面试中的Singleton
  • 原文地址:https://www.cnblogs.com/heimark/p/2029111.html
Copyright © 2011-2022 走看看