Blazor WebAssembly-如何安全使用私有/受限制的API? [英] Blazor WebAssembly - how to securely consume private/restricted API?

查看:47
本文介绍了Blazor WebAssembly-如何安全使用私有/受限制的API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建2个应用.

  1. .NET中的私有API,负责数据库访问/数据处理.
  2. Blazor WebAssembly应用程序,它将安全地连接到此API,以搜索数据.

由于Blazor WebAssembly DLL可以反编译,所以我不能在APP中使用任何私钥/秘密密钥.我不希望任何人都能发现端点,就可以使用该API.只有Blazor APP可以使用API​​(以及我将来可能会构建的任何其他应用程序).

Since Blazor WebAssembly DLLs can be decompiled, I can't use any private/secret keys in the APP. I don't want anyone being able to use the API if they discover the endpoints. Only the Blazor APP can use the API (and any other app I might build in the future).

我应该如何处理?甚至有可能安全地执行此操作,还是应该去服务器端?

How should I approach this? Is it even possible to do it securely or should I go Server Side?

推荐答案

Secure ASP.NET Core Blazor WebAssembly explains how to secure a Blazor WASM app

Blazor WebAssembly3.2.0 Preview 2现已发布,其中说明了如何使用 IAccessTokenProvider 获取访问令牌以在API上对您的应用程序进行身份验证.

Blazor WebAssembly 3.2.0 Preview 2 release now available explains how to use IAccessTokenProvider to get the access token to authentify your applicaton on API.

这篇关于Blazor WebAssembly-如何安全使用私有/受限制的API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆