小编Mar*_*rco的帖子

在复合 GitHub 操作中向 docker 容器提供参数

我正在尝试在复合 GitHub Action 中传递一些动态创建的参数。

\n

然而,文档缺少有关如何在这种情况下将参数传递给 docker 容器的示例。

\n

https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runsstepsuses

\n

在这里看看我想要实现的目标。

\n
runs:\n  using: \'composite\'\n  steps:\n    - name: compose arguments\n      id: compose-args\n      shell: bash\n      run: |\n        encoded_github="$(echo \'${{ inputs.github_context }}\' | base64)"\n        encoded_runner="$(echo \'${{ inputs.runner_context }}\' | base64)"\n\n        args=(\'${{ inputs.command }}\')\n        args+=(\'${{ inputs.subcommand }}\')\n        args+=(\'--github-context\')\n        args+=("${encoded_github}")\n        args+=(\'--runner-context\')\n        args+=("${encoded_runner}")\n        args+=(\'${{ inputs.arguments }}\')\n\n        echo "::set-output name=provenance_args::$(echo "[$(printf "\\"%s\\"," ${args[*]})]" | sed \'s/,]$/]/\')"\n    - name: Debug arguments\n      shell: bash\n      run: |\n        echo Running slsa-provenance with following arguments\n        echo ${{ steps.compose-args.outputs.provenance_args }}\n    - …
Run Code Online (Sandbox Code Playgroud)

github docker github-actions

7
推荐指数
1
解决办法
2351
查看次数

使用passport-http Basic + passport-local组合时,如何防止www-authenticate标头

嗨,我想在我的应用程序中支持formbased身份验证和http基本身份验证.一切都按预期工作,除非我使用基于表单的auth通过angularjs与错误的凭据.

浏览器不显示我的角度代码处理401,而是显示由WWW-Authenticate标头引起的BASIC auth对话框.

如何在使用本地策略时阻止添加标头?或者我如何以不同的方式支持这两种机制?

我在基于Express的应用程序中使用以下路由.

api.post('/authenticate', passport.authenticate(['local', 'basic'], { session: false }), function (req, res) {
Run Code Online (Sandbox Code Playgroud)

这将在该URL上启用两种身份验证方法.我再说一遍,当我使用formbased使用错误的凭据时,它会向我显示基本的auth对话框(我不希望这样).

以下是我如何注册策略.

passport.use(new BasicStrategy({ realm: 'Authentication failed. Wrong username or password.'}, verifyLocalUser));
passport.use(new LocalStrategy(verifyLocalUser));
Run Code Online (Sandbox Code Playgroud)

这就是我的verifyUser方法的样子......

var verifyLocalUser = function (username, password, next) {
    User.findOne({
        username: username
    }).select('fullname admin username password').exec(function (err, user) {
        if (err) {
            return next(err);
        }

        if (user && user.comparePasswords(password)) {
            return next(null, user);
        } else {
            next(null, false, { message: 'Authentication failed. Wrong username or password.' });
        }
    });
} …
Run Code Online (Sandbox Code Playgroud)

node.js express angularjs passport-local passport.js

6
推荐指数
1
解决办法
460
查看次数

'docker run -v'在使用Docker Toolbox的Windows上不起作用

从CoreOS VM运行以下命令时,它按预期工作:

docker run --rm -v $PWD:/data composer init
Run Code Online (Sandbox Code Playgroud)

它将composer.json使用指定的Docker卷映射初始化当前工作目录中的文件.Docker容器基本上安装了PHP工具组合器,并将/data在容器的文件夹中运行该工具.通过使用映射,它实际上将其应用于主机上的文件.

但是,当尝试使用Docker Toolbox在Windows上运行此命令时,我收到以下错误.

$ docker run --rm -v $PWD:/data composer --help
invalid value "C:\\Users\\Marco;C:\\Program Files\\Git\\data" for flag -v: bad mount mode specified : \Program Files\Git\data
See 'C:\ProgramData\Chocolatey\lib\docker\bin\docker.exe run --help'.
Run Code Online (Sandbox Code Playgroud)

我在这里注意到的是,虽然我在Git Bash执行命令时它仍使用Windows路径.那么我试着跟随(用引号括起来):

$ "docker run --rm -v $PWD:/data composer --help"
bash: docker run --rm -v /c/Users/Marco:/data composer --help: No such file or directory
Run Code Online (Sandbox Code Playgroud)

现在它无法找到该目录.

我也试过没有$ PWD变量,但这没有什么区别.

如何在Windows上进行此操作?

windows bash docker coreos docker-toolbox

5
推荐指数
1
解决办法
1432
查看次数

在异步任务中登录Elmah

我需要在我的网络服务器上执行的异步任务中记录一些Elmah.但是当我尝试记录错误时,由于HttpContext而失败.

        var httpContext = HttpContext.Current;

        Task.Factory.StartNew(() =>
        {
            HttpContext.Current = httpContext;

            try
            {
                //Execute some code
            }
            catch (Exception ex)
            {
                //Generate some error for the user and log the error in Elmah
                try
                {
                    ErrorLog.GetDefault(HttpContext.Current).Log(new Error(ex));
                }
                catch(Exception ex)
                {
                }
            }
        });
Run Code Online (Sandbox Code Playgroud)

为了获得任务的进展,我实施了一些轮询机制.目前没有任何错误记录到Elmah,这使得难以解决它们.

同时提供上下文作为参数也不起作用.

它不起作用.我得到一个ArgumentException告诉我预期值不在预期范围内.使用以下堆栈跟踪:

在System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(的Int32的errorCode,IntPtr的errorInfo中)在System.Web.Hosting.IIS7WorkerRequest.GetServerVariableInternal(字符串名称)在System.Web.HttpRequest.AddServerVariableToCollection(字符串名称)在System.Web.HttpRequest.位于Elmah.ServiceContainer的Elmah.ErrorLog.GetDefaultImpl(HttpContext上下文)的Elmah.ErrorLog.InferApplicationName(HttpContext上下文)的System.Web.HttpServerVarsCollection.Get(String name)处的System.Web.HttpServerVarsCollection.Populate()处的FillInServerVariablesCollection(). GetService的(类型的serviceType)在Elmah.ServiceCenter.GetService(对象上下文中,类型的serviceType)在Elmah.ErrorLog.GetDefault(HttpContext的上下文)在Bis.Utilities.Log.ElmahErrorLog.TryLogError(例外exeption)在d:\ Users\A500535\Documents\Projecten\Biobank\Bis\src\Utilities\Log\ElmahErrorLog.cs:第13行

model-view-controller logging elmah asp.net-mvc-3

4
推荐指数
1
解决办法
1560
查看次数

ejabberd中的oauth2身份验证支持

我目前正在寻找如何使用我们自己的应用程序中的oauth2令牌对ejabberd进行身份验证。

是否有可用的解决方案使我能够在自己的产品中进行身份验证,然后使用该oauth2 JWT令牌针对ejabberd进行身份验证。

或者,也许是另一个问题,我该如何同步ejabberd用户和我自己的应用程序用户。

我正在为我们的用户寻找一种单一登录方式。

我看到了使用每次登录时生成的令牌更新ejabberd用户密码的建议。然后只需使用用户名和令牌登录ejabberd。但是,这听起来不像是破解,而是真正的解决方案。

有任何人对此有经验吗?我对Erlang没有任何经验。如果有人可以指出我正确的方向,那就太好了。

erlang xmpp ejabberd oauth-2.0

4
推荐指数
1
解决办法
1755
查看次数

jquery表单发布两次

我在按钮中使用以下javascript代码发布我的表单.

var formIsValid = $('#createFreezerForm').valid();
if (formIsValid) {
    $('#createFreezerForm').submit();
}
return false;
Run Code Online (Sandbox Code Playgroud)

我正在为使用MVC3 Ajax.Form助手创建的表单执行此操作.

不知何故,我的表格被发布两次.有什么建议?

这是生成的html

<div id="freezerDialog" class="ui-dialog-content ui-widget-content" style="width: auto; min-height: 64px; height: auto; "><form action="/BiobankWebsite/Storage/Freezer/Create" data-ajax="true" data-ajax-failure="errorAjaxCall" data-ajax-method="post" data-ajax-mode="replace" data-ajax-success="freezerOverview.formPostComplete" data-ajax-update="#createFreezerForm" id="createFreezerForm" method="post">
    <input name="__RequestVerificationToken" type="hidden" value="cu92co3Mwzt28mB3WCXGsmKYJ4RUQJxPcUUtQ4jyOcjrg82Y0QRJtGcmP818Isbd6bYqqMXj9xJOzt18TkSzFQerWNnu4F6b8pjSvvWjXNRSC3LYvisDR9+jjkG0ygtBWNSowIvdMva+Cq/9X9B9cQT2x6yOauFRen7vkmVDQMDJu9LWMZH4Z3Q6IEbonUMk"><input data-val="true" data-val-required="The FreezerId field is required." id="FreezerId" name="FreezerId" type="hidden" value="00000000-0000-0000-0000-000000000000">
<div class="validation-summary-valid" data-valmsg-summary="true">
    <span>Validation messages</span>
    <ul><li style="display:none"></li></ul>
</div>
<div class="left marginRight">
    <div class="editor-label">
        <label for="FreezerType">Freezer type</label>
    </div>
    <div class="editor-field">
        <select data-val="true" data-val-required="The Freezer type field is required." id="FreezerType" name="FreezerType"> …
Run Code Online (Sandbox Code Playgroud)

ajax jquery asp.net-mvc-3

3
推荐指数
1
解决办法
3644
查看次数

在WMAppManifest中设置时,标志性瓷砖BackgroundColor无法正常工作

在WMAppManifest中设置背景颜色时,如下例所示,仍然使用手机主题颜色.

微软文档指出它只有在颜色以#FF开头时才有效... http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207009(v=vs.105).aspx

重要说明:如果BackgroundColor元素的颜色值不以#FF开头,例如#FF524742,则不会显示自定义背景颜色,而是显示默认主题颜色.

<Tokens>
  <PrimaryToken TokenID="WindowsPhoneApp" TaskName="_default">
    <TemplateIconic>
      <SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\IconicTileSmall.png</SmallImageURI>
      <Count>0</Count>
      <IconImageURI IsRelative="true" IsResource="false">Assets\Tiles\IconicTileMediumLarge.png</IconImageURI>
      <Title>WindowsPhoneApp</Title>
      <Message>
      </Message>
      <BackgroundColor>#FF016FAC</BackgroundColor>
      <HasLarge>True</HasLarge>
      <LargeContent1>
      </LargeContent1>
      <LargeContent2>
      </LargeContent2>
      <LargeContent3>
      </LargeContent3>
      <DeviceLockImageURI IsRelative="true" IsResource="false">
      </DeviceLockImageURI>
    </TemplateIconic>
  </PrimaryToken>
</Tokens>
Run Code Online (Sandbox Code Playgroud)

如何使这个工作?这是一个已知的错误?

c# windows-phone windows-phone-8

3
推荐指数
1
解决办法
686
查看次数