小编Sér*_*hin的帖子

Microsoft AD 应用程序验证失败:“microsoft-identity-association.json 的内容长度未设置或无效”

我正在努力使用 Azure Active Directory 验证我们的应用程序,以使用他们的 SSO。

为了验证我们的域名,他们要求在以下地址提供一个 JSON 文件:{publisher_domain}/.well-known/microsoft-identity-association.json

在我们的 Flask 应用程序中,我使用以下路线提供文件:

@app.route('/.well-known/microsoft-identity-association.json')
def microsoft_identity_association():
    file = '.well-known/microsoft-identity-association.json'

    return send_file(file, mimetype='application/json')
Run Code Online (Sandbox Code Playgroud)

我还尝试将 JSON 加载到字典中并返回字典,让 Flask 渲染响应:

@app.route('/.well-known/microsoft-identity-association.json')
def microsoft_identity_association():
    file = '.well-known/microsoft-identity-association.json'
    with open(file, encoding="utf-8") as file:
        result = ujson.load(file)
        response = flask.Response(result, mimetype='application/json')
        response.headers.add('content-length' , str(result.__len__()))

    return send_file(file, mimetype='application/json')
Run Code Online (Sandbox Code Playgroud)

但每次,我都会得到相同的结果:

在对 GET 请求的响应中,content-length标头存在于我的本地环境中,但在我的应用程序部署在 Google App Engine Flex 上时消失。我检查了他们的文档(https://cloud.google.com/appengine/docs/flexible/python/reference/request-headers)并联系了他们,但没有真正成功。
他们说“看起来这正在按预期工作。HTTP/2 不需要“内容长度”,因此它被剥离了。”

看起来这个 Microsoft 应用程序验证程序是新的(2019 年 5 月),因此很难找到类似的问题。

这里有人遇到过同样的情况并希望找到解决方案吗?

google-app-engine http flask azure-active-directory

2
推荐指数
1
解决办法
1576
查看次数

使用 Elm 生成随机 UUIDv4

我正在尝试在循环中生成随机 UUID v4:

    randomUuid =
         -- TODO: find a way to generate random uuid for variableId

    updatedVariables =              
         group.variables |> List.map (\variable -> { variable | id = randomUuid })
Run Code Online (Sandbox Code Playgroud)

我阅读了elm/randomelm/uuid的文档,但找不到如何在不使用种子的情况下生成 UUID。

我唯一能做的就是:

newUuid : Random.Seed -> ( String, Random.Seed )
newUuid seed =
    seed
        |> Random.step UUID.generator
        |> Tuple.mapFirst UUID.toString
Run Code Online (Sandbox Code Playgroud)

我将 elm/random 视为一个independentSeed函数,但我无法让它生成种子。

我想要实现的节点相当于randomUuid

    randomUuid =
         -- TODO: find a way to generate random uuid for variableId

    updatedVariables =              
         group.variables |> List.map …
Run Code Online (Sandbox Code Playgroud)

random uuid elm

2
推荐指数
1
解决办法
619
查看次数