您好,我正在探索与天蓝色活动目录相关的一些身份验证和授权流程。我之前在单页应用程序中使用了誓言隐式流程。在花时间阅读微软文档之后,我了解了以下关于隐式流程的内容。
\n\n\n隐式流程:
\n
单页 javacript 应用程序使用隐式流从 azure Active Directory 获取访问令牌。它直接调用令牌端点来获取令牌,因此这使得隐式流的安全性降低。
\n\n\n.Net Web 应用程序中的授权遵循
\n
每当我们使用带有授权代码流的.Net Core Web MVC应用程序时,浏览器中都会首先调用授权端点来获取代码。在浏览器中我们可以看到向授权端点发出的请求。在请求 url 中,我将传递响应类型作为代码,然后传递客户端 ID 和重定向 ui。这里第一次握手发生在浏览器和授权端点之间。此握手将代码返回到重定向 uri。下一部分,应用程序必须向令牌端点发出 POST 请求以获取访问令牌。第一步收到的代码我将发送令牌请求。在此请求中,我还将包含客户端机密和重定向 uri。但是每当我向授权端点发出第一个 GET 请求时,我都不会传递客户端秘密。这是因为在浏览器中暴露秘密并不好。因此,在第二篇帖子请求中,我还将包括客户秘密。获得访问令牌后,我会将其添加到 api 请求标头中,以对 api 进行安全调用。\n这是我所理解的关于 .Net core Web 应用程序的授权代码流风格。现在我有关于单页应用程序的另一种授权代码。
\n\n\nReact Web App 中的授权代码流程
\n
我有使用 MSAL 库的 SPA React 应用程序。我已经从 github https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/3-Authorization-II/1-call-api/SPA克隆了示例应用程序。
\n每当我运行此应用程序并登录时,第一个调用将如下所示
\n https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=https://login.microsoftonline.com/c5ffa990-7e0a-4bf6-6c04-79ab98e05931/oauth2/v2.0/authorize\nRun Code Online (Sandbox Code Playgroud)\n我正在尝试理解这个请求。我已将查询字符串附加到网址authorization_endpoint=https://login.microsoftonline.com/c5ffa990-7e0a-4bf6-6c04-79ab98e05931/oauth2/v2.0/authorize,因此这可用于从授权服务器返回代码。 \n下一个调用将立即发生https://login.microsoftonline.com/c5ffa990-7e0a-4bf6-6c04-79ab98e05931/oauth2/v2.0/token
要获取访问令牌并在 FormData 部分的请求中,我可以看到以下参数
\nclient_d, redirect_uri,scope,code\nRun Code Online (Sandbox Code Playgroud)\n在代码中,我看到一些希望从授权端点收到的代码值。无论如何,这个 api 返回了我的 access_token。 …
Net core 应用程序,我正在尝试挂载 azure 文件共享。下面是我的 docker-compose 文件。
version: "3.9"
services:
mountvolume:
container_name: mountvolume
build:
context: .
dockerfile: ./Dockerfile
ports:
- "8080:80"
volumes:
- myvol:/Files/
volumes:
myvol:
driver: azurefile
driver_opts:
accountname: mystorageaccount28628
accountkey: 2em0XONHCmgEE9m81Q/O0rTSGXf9giw==
share: "acishare"
remotepath: "aci/logs"
Run Code Online (Sandbox Code Playgroud)
我已在存储帐户之一中手动创建名为 acishare 的 FileShare。我已经给出了与上面相同的存储帐户的帐户名和密钥。我尝试 docker-compose up 并得到以下错误
ERROR: Volume myvol specifies nonexistent driver azure file
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个错误吗?另外,在上面的卷部分中,我有字段 share 和 Remotepath,因此 share 表示文件共享名称,但远程路径到底意味着什么?有人可以帮我弄清楚吗?任何帮助,将不胜感激。谢谢
您好,我正在使用 c# azure 函数和 java 脚本。我有本地运行的网页,并且也在本地点击了 azure 函数。下面是我的天蓝色函数,它运行在
协商:[POST] http://localhost:7071/api/negotiate
[FunctionName("negotiate")]
public static async Task<SignalRConnectionInfo> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req, IBinder binder,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
var data = await Authenticated(req, log);
var connectionInfo = binder.Bind<SignalRConnectionInfo>(new SignalRConnectionInfoAttribute { HubName = "MapUpload", UserId = data });
return connectionInfo;
}
Run Code Online (Sandbox Code Playgroud)
然后在 local.settings.json 我已经配置
"Host": {
"CORS": "*"
}
Run Code Online (Sandbox Code Playgroud)
下面是我的java脚本代码。
<script>
const connection = new signalR.HubConnectionBuilder()
.withUrl('http://localhost:7071/api/')
.configureLogging(signalR.LogLevel.Information)
.build();
connection.on('MapUpload', productOrdered);
connection.onclose(() => console.log('disconnected'));
console.log('connecting...');
connection.start()
.then(() …Run Code Online (Sandbox Code Playgroud) Net Core 应用程序映像,我正在尝试在本地 kubernetes 中创建部署。我创建了 docker 镜像,如下所示。
docker tag microservicestest:dev microservicestest .
docker build -t microservicestest .
docker run -d -p 8080:80 --name myapp microservicetest
Run Code Online (Sandbox Code Playgroud)
然后我创建了部署,如下所示。
kubectl run microservicestest-deployment --image=microservicestest:latest --port 80 --replicas=3
kubectl expose deployment microservicestest-deployment --type=NodePort
Run Code Online (Sandbox Code Playgroud)
然后当我看到 Kubectl get pods 时,我看到以下错误
以下是我运行 docker images 时的输出
下面是输出
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
creationTimestamp: "2020-09-22T04:29:14Z"
generation: 1
labels:
run: microservicestest-deployment
name: microservicestest-deployment
namespace: default
resourceVersion: "17282"
selfLink: /apis/apps/v1/namespaces/default/deployments/microservicestest-deployment
uid: bf75410a-d332-4016-9757-50d534114599
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10 …Run Code Online (Sandbox Code Playgroud) 嗨,我在 c# 工作,我有两个列表如下
public class Table1
{
public long Id { get; set; }
public int mid {get;set;}
public int ChannelId { get; set; }
public string Header { get; set; }
public string FirstData { get; set; }
public string Type { get; set; }
public string SubType { get; set; }
public string Unit { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
public class Table2
{
public long Id { get; set; }
public int mid {get;set;}
public int ChannelId { …Run Code Online (Sandbox Code Playgroud) asp.net-core ×2
c# ×2
docker ×2
.net ×1
azure ×1
containers ×1
cors ×1
javascript ×1
kubectl ×1
kubernetes ×1
list ×1
oauth-2.0 ×1
reactjs ×1