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> 

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

  • 相关阅读:
    【线段树合并】联通分量计数
    莫队算法
    Ubuntu实用软件安装[转]
    装系统·折腾记
    Qt环境配置 + Qt使用教程
    Google题解
    隐含马尔科夫模型
    Pythonの坑
    C++11并发编程个人小结
    微软2017年预科生计划在线编程笔试
  • 原文地址:https://www.cnblogs.com/heimark/p/2029111.html
Copyright © 2011-2022 走看看