This code sample is for .NET Lab community online session.
React Helmet controls a Head tag of HTML. A link rel attribute, a style attribute, a title attribute, and so on.
Thus, it is available that multiple pages of a contents is managed by React Helmet.
Addition, individual page can control style of shared controls such as the _Layout.chtml without modifing class structure or style of shared controls.
Fukuoka.NET #9 https://fukuten.connpass.com/event/75232/
ASP.NET MVC内部でNullReferenceExceptionを潰していることを発見!
Friends Dont Let Friends Swallow NullReferenceException (Japanese Edition)
https://medium.com/p/friends-dont-let-friends-swallow-nullreferenceexception-acd949833d70
Fukuoka.NET #9 https://fukuten.connpass.com/event/75232/
ASP.NET MVC内部でNullReferenceExceptionを潰していることを発見!
Friends Dont Let Friends Swallow NullReferenceException (Japanese Edition)
https://medium.com/p/friends-dont-let-friends-swallow-nullreferenceexception-acd949833d70
Service Mesh endpoint needs features such as the Logging feature, the Hardware abstraction feature, Authentication and Authorization and so on, these features are provided several cloud venders as a service, or also can use the Envoy server and the Istio service mesh pilot feature. But creating the service mesh endpoint with ASP.NET Cor Web API minimal template is efficient to learn these cloud native architecture.
The Options Pattern can build a hierarchical settings values structure. In the previous article [ASP .NET Core Options Pattern], a settings values of The .NET Generic Host that created by the host builder were registered to the host as a service as it is, and were used in the UI layer although, the Options Pattern in .NET Core must be applied the Options Pattern as the configuration service before registered to the host.
For team development, Microservices fits for team development, Atomic Design is well working to Microservices development if layout is devides from contents.
WebAssemblyとBlazor 、WebAssembly System Interfaceでコンテナライズの設計を解説Takao Tetsuro
WebAssembly(WASM)とWebAssembly System Interface(WASI)は、コンテナライゼーションのアーキテクチャのひとつです。DockerやWSL(Windows Subsystem for Linux)と同じく、皆さんの業務ロジックにモビリティとスケーラビリティを与えてくれます。モビリティとスケーラビリティを考慮したプログラムを作る一例として、Rust、Nodeなどの技術を交えコンテナライゼーションを解説します。
In web app development, the Microservices architecture and atomic design software development process can increase development efficiency.
When use these technologies, using tools also needs such as the Postman, the Podman, the Pixlr X, the Method draw, and the Swagger editor, Visual Studio and Visual Studio Code.
This presentation explain the process that you use these tools.
59. Orleans: Distributed Virtual Actors for Programmability and Scalability
https://www.microsoft.com/en-us/research/publication/orleans-distributed-virtual-actors-for-programmability-and-
scalability/
Design patterns for modern web APIs
https://blog.feathersjs.com/design-patterns-for-modern-web-apis-1f046635215
Atomic Design Methodology
https://atomicdesign.bradfrost.com/chapter-2/
Editor's Notes
タイトルは「React helmetでASP.NET Core Web app」となっていますが、中身は「ASP.NET Core Web appでReact helmet」という感じなのでご了承ください。これは、マイクロサービスのステートフルミドルウェアを何で実装するかによって主語が変わってきますので、そのあたりの話に注目して聞いてみてください。本資料は58ページありますから設計の話を中心にして、実装に関してはかなり急ぎで説明します。そのため、事前に資料とソースコードをダウンロードして聞いていただけると良いかと思います。
問題解決領域ではステート管理は必須ですが、Webサービスとエッジ側UIの間はステートレスにする必要があります【クリック】(これはWebアプリを設計する際のパターン&プラクティスです)。こちらも巻末にリンクを載せています。Mediumの「Design patterns for modern web APIs」という記事ですが非常によくまとまっています。【クリック】
これを両立させるため、Restful APIやステートフル・ミドルウェア【クリック】という選択が行われるわけですが、ASP.NET MVCで取り回しの良いモデルを使っていてもエッジ・サイドのWebページでそのモデルが使えなければ不便です【クリック】。【クリック】
アカウントコントローラーを追加してSignInアクションをvoidで追加します。SignInアクションではAzure Active Directory Endpointにリダイレクトさせるだけです。実行してAuthorizationコードがアドレスバーに返ってきていることを確認します。
Codeを受け取れることがわかったら、HomeコントローラーのIndexアクションでそれを使ってトークンを取得する部分を作成していきます。
Azure Active Directory ApplicationにリダイレクトURLを登録してありますので、Indexアクションの中でcodeを受け取れるわけです。
Microsoft Graph APIにaccess_tokenを受け取るリクエストを送って、受け取ったaccess_tokenでサインインボタンの部分にディスプレイネームを表示するようにViewBagに格納します。
Azure Active Directory Endpointは、Authorizationコードを受け取って該当の組織で認証されたことを確認出来たら該当の組織で有効なトークンを発行します。プログラムはトークンを取得したらMicrosoft Graph APIに対して自分のプロフィールを要求します。この際、プログラムは誰がログインしているか?を知る必要はありません。認証したユーザーにとっての「自分のプロフィール」を取得します。
Microsoft Graph APIが返却する型を用意しておくと、JsonSerializerでクラスにデータを格納することができますので、そのまま保存することもできます。ただし、OAuthは認証と承認を分離するところに意味がありますので、このクラスを包含するApplication Userクラスを作って、それをプロパティとして持つログインモデルを作ります。このログインモデルをシリアライズして永続化層に保存することでログインステートを管理できます。
ログインするとログインのステートを保存するようになっています。今回のサンプルはテキストファイルにしています。この際使用するモデルはMicrosoft Azure Active Directory Endpointから提供される永続化している認証用のAzure Active Directoryのモデルを作っています。各ブランド(MicrosoftやFacebookなど)共通に「id」を持ったクラスを用意し、それを継承して各ブランドのモデルを作っています。このモデルは認証用のモデルなので、承認用のモデルは別途作成します。
ログインするとログインのステートを保存するようになっています。今回のサンプルはテキストファイルにしています。この際使用するモデルはMicrosoft Azure Active Directory Endpointから提供される永続化している認証用のAzure Active Directoryのモデルを作っています。各ブランド(MicrosoftやFacebookなど)共通に「id」を持ったクラスを用意し、それを継承して各ブランドのモデルを作っています。このモデルは認証用のモデルなので、承認用のモデルは別途作成します。