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> 

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

  • 相关阅读:
    docker重启提示已存在一个容器的问题处理
    conda虚拟环境安装
    dell5460笔记本电脑ubuntu18.04系统音频驱动的安装和使用
    CentOS8的网络管理变化
    jupyter notebook 安装扩展nbextensions
    win10系统systeminfo命令的过滤用法
    《学习scrapy框架爬小说》的进一步完善
    记手机端 下拉加载新数据
    记 页面使用overflow-scroll在iOS上滑动卡顿的问题
    记 判断手机号运营商function
  • 原文地址:https://www.cnblogs.com/heimark/p/2029111.html
Copyright © 2011-2022 走看看