Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/tomlm/Crazor
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlm committed Sep 5, 2024
2 parents a48f883 + e89ef53 commit d61daa7
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 158 deletions.
18 changes: 8 additions & 10 deletions docs/Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ The Crazor is running on a server and servicing any of the CardApps defined ther
* **CardAppController** - When the card is running a s teams/outlook/office integration, the card UI is delivered via the CardAppController to the client. All rendering is client side and all logic is running server side.
* **Card Host Page** - When someone navigates to the card app host page the card is is hosted via HTML, with all rendering client side and all logic running server side.

This is true regardless of the ICardView implementation that is being used to turn templates into cards.

## Concepts

* [Architecture](docs/Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](docs/CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](docs/CardView.md) - General information about Card Views
* [Memory](docs/Memory.md) - Information on persistence and memory
* [Validation](docs/Validation.md) - Model validation
* [Routing](docs/RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](docs/authentication.md) - Authentication
* [Unit tests](docs/UnitTests.md) - Writing unit tests for your cards.
* [Architecture](Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](CardView.md) - General information about Card Views
* [Memory](Memory.md) - Information on persistence and memory
* [Validation](Validation.md) - Model validation
* [Routing](RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](authentication.md) - Authentication
* [Unit tests](UnitTests.md) - Writing unit tests for your cards.
47 changes: 9 additions & 38 deletions docs/Authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,9 @@ To create per-user authenticated views you need to
* **Authenticate** - get credentials for the user to identify the user
* **Authorize** - validate the the user has is authorized to perform the action.

# Setting up your service

To enable SSO auth flows you need to do two tasks:

* **Update Azure AD Application** - define an Azure application with appropriate auth flows
* **Update Bot** - You need to configure your bot to add the OAuth connection.

## Configure your Azure AD App to support SSO

Follow instructions here to create a Azure AD SSO app

[Configure your app in Azure AD - Teams | Microsoft Learn](https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/bot-sso-register-aad?tabs=botid)

**Notes**

> 1. enter the application ID URI as ```api://botid-{BotAppId}```. Here, {BotAppId} is your Azure AD application ID.
> 2. Add ```https://token.botframework.com/.auth/web/redirect``` as your redirect UR (see [Supported OAuth URLs - Bot Service | Microsoft Learn](https://learn.microsoft.com/en-us/azure/bot-service/ref-oauth-redirect-urls?view=azure-bot-service-4.0) for list of other redirect uris)
> 3. Add ```https://{YOURDOMAIN}/
## Configure your bot OAuth Connection

[Configure your app in Azure AD - Teams | Microsoft Learn](https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/bot-sso-register-aad?tabs=botid#configure-oauth-connection)

**Notes**

> You should give the OAuth a **connection** **name** that you want to refer to from your cards
Make sure to test your connection to validate it's configured correctly.

# Update your card views

Now that you have your service set up you modify you card views to have authenticate the user and authorize their access.
You need to modify you card views to have authenticate the user and authorize their access.

## Authentication

Expand Down Expand Up @@ -194,14 +165,14 @@ With Blazor you can use **<CascadingAuthenticationState>** and **<AuthorizeView>

## Concepts

* [Architecture](docs/Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](docs/CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](docs/CardView.md) - General information about Card Views
* [Memory](docs/Memory.md) - Information on persistence and memory
* [Validation](docs/Validation.md) - Model validation
* [Routing](docs/RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](docs/authentication.md) - Authentication
* [Unit tests](docs/UnitTests.md) - Writing unit tests for your cards.
* [Architecture](Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](CardView.md) - General information about Card Views
* [Memory](Memory.md) - Information on persistence and memory
* [Validation](Validation.md) - Model validation
* [Routing](RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](authentication.md) - Authentication
* [Unit tests](UnitTests.md) - Writing unit tests for your cards.



Expand Down
4 changes: 2 additions & 2 deletions docs/Blazor/CardView.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ For example this .razor file:
```c#
@inherits CardView

<Card Version="1.4"&gt;
<TextBlock Size="AdaptiveTextSize.Large"&gt;Session Counter:@Counter</TextBlock>
<Card Version="1.4">
<TextBlock Size="AdaptiveTextSize.Large">Session Counter:@Counter</TextBlock>

<ActionExecute Title="Increment" Verb="@nameof(OnIncrement)" />
<ActionExecute Title="Decrement" Verb="@nameof(OnDecrement)" />
Expand Down
39 changes: 24 additions & 15 deletions docs/Blazor/CountersWalkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ Create **/Cards/Counters/Default.razor**

Things to notice:

* ```@inherits CardView``` defines that our card view is a Crazor CardView class.
* The local property **Counter** is automatically persisted with session scope as part of the card view.
* We have methods hooked up to the verbs which are simply the methods to call to change the properties.
* We have OnIncrement() method hooked up to the ActionExecute verb.

That's it. Now run the application and go to the Counters app.

Expand All @@ -55,12 +56,14 @@ You should see something like this:

As you click on it, the card is refreshing itself and updating the values. If you copy and paste the link to another browser window you will see that the session values are per window.

# Adding a CardApp
# Adding a custom CardApp

Now we will are going to modify the app to have a counter which is shared among all viewers of the card.
By default we have a CardApp which does all of the bookkeeping for managing the card views.

* **Counter** => Is a value which each person who interacts with the card sees.
* **SharedCounter** => will be a value that all people who interact with the card see and share.
Now we will are going to create a custom CardApp which will have a shared counter which is shared among all viewers of the card.

* **View.Counter** => Is a value which each person who interacts with the card sees.
* **App.SharedCounter** => will be a value that all people who interact with the card see and share.

## 1. Create a CountersApp.cs file

Expand Down Expand Up @@ -89,7 +92,7 @@ This illustrates the intelligent memory system that Crazor supports. Instead of

Now we will modify the **Default.razor** to interact with the **CountersApp.**

* Change the **default.razor** inherits statement to **@inherits CardView<CountersApp>** . This tells the CardView that the **App** property is of type **CountersApp**
* Change the **default.razor** inherits statement to **@inherits CardView&lt;CountersApp&gt;** . This tells the CardView that the **App** property is of type **CountersApp**

* Update to bind to **App.SharedCounter** and add a verb handler to increment it.

Expand Down Expand Up @@ -125,21 +128,27 @@ You should see something like this:

![image-20221103120318266](../assets/image-20221103120318266.png)



# Next Steps
* [Installing your card applications into teams](../Teams.md)

* [Create an app with actions](CountersWalkthrough.md)

# More information
# More Crazor.Blazor information

* [Card Views](CardView.md) - How to define views with **CardView** with **Blazor**
* [Card Apps](../CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card App Memory](../Memory.md) - Information on persistence and memory model
* [Card Routing](../RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](../Authentication.md) - Authenticating users and Authorizing access to create per-user secure views
* [Writing Unit tests](../UnitTests.md) - Writing unit tests for your cards.
* [Components (Advanced)](Components.md) - How to define reusable components via Blazor Components
*
## Crazor Concepts

* [Architecture](docs/Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](docs/CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](docs/CardView.md) - General information about Card Views
* [Memory](docs/Memory.md) - Information on persistence and memory
* [Routing](docs/RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Unit tests](docs/UnitTests.md) - Writing unit tests for your cards.

## Advanced topics

* [ICard View](docs/ICardView.md) - Information on **ICardView** interface


![image](https://user-images.githubusercontent.com/17789481/197365048-6a74c3d5-85cd-4c04-a07a-eef2a46e0ddf.png)
Expand Down
23 changes: 13 additions & 10 deletions docs/Blazor/QuickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ This will walk you through creating a Crazor App Project using Blazor.

# Prerequisites

[Install Prerequisite tools](InstallTools.md)
[Install Prerequisite tools](../InstallTools.md)

# Creating a bot project from Visual Studio
# Creating a new project service for hosting card applications
Cards are part of card applications and they are hosted in a ASP.NET web service. There are two easy ways of creating a new hosting service.

## Option 1: Creating from Visual Studio

Create a **Crazor App Server** project

![image-20240621213410771](assets/image-20240621213410771.png)

> NOTE: you can alternatively create the project from the cli by using
>
> ```cmd
> dotnet new crazorserver
> ```
>
## Option 2: Creating from CLI

NOTE: you can alternatively create the project from the cli by using
```cmd
dotnet new crazorserver
```

# Add a dev tunnel for local development

Expand Down Expand Up @@ -52,13 +55,13 @@ Make sure that **Use Tunnnel Domain** is turned on:
# Register your bot

In the same folder as your csproj, run **RegisterBot** tool to create a development bot called **MyBot-Dev**.
In the same folder as your csproj, run [RegisterBot](../RegisterBot.md) tool to create a development bot called **MyBot-Dev**.

```cmd
registerbot --name MyBot-Dev --endpoint https://jx4wclpb-7232.usw2.devtunnels.ms/
```

> NOTE: By convention we use **MyBot-Dev** because when we publish to production we want to register **MyBot** as the production bot
> NOTE: By convention we use **{BOTNNAME}-Dev** because when we publish to production we want to register **{BOTNAME}** as the production bot
# Run project

Expand Down
16 changes: 8 additions & 8 deletions docs/CardApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,14 @@ ReplaceView<MyCodeView>();

## Concepts

* [Architecture](docs/Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](docs/CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](docs/CardView.md) - General information about Card Views
* [Memory](docs/Memory.md) - Information on persistence and memory
* [Validation](docs/Validation.md) - Model validation
* [Routing](docs/RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](docs/authentication.md) - Authentication
* [Unit tests](docs/UnitTests.md) - Writing unit tests for your cards.
* [Architecture](Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](CardView.md) - General information about Card Views
* [Memory](Memory.md) - Information on persistence and memory
* [Validation](Validation.md) - Model validation
* [Routing](RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](authentication.md) - Authentication
* [Unit tests](UnitTests.md) - Writing unit tests for your cards.



Expand Down
16 changes: 8 additions & 8 deletions docs/CardView.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,14 @@ public override async Task&lt;AdaptiveChoice[]&gt; OnSearchChoicesAsync(SearchIn

## Concepts

* [Architecture](docs/Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](docs/CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](docs/CardView.md) - General information about Card Views
* [Memory](docs/Memory.md) - Information on persistence and memory
* [Validation](docs/Validation.md) - Model validation
* [Routing](docs/RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](docs/authentication.md) - Authentication
* [Unit tests](docs/UnitTests.md) - Writing unit tests for your cards.
* [Architecture](Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](CardView.md) - General information about Card Views
* [Memory](Memory.md) - Information on persistence and memory
* [Validation](Validation.md) - Model validation
* [Routing](RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](authentication.md) - Authentication
* [Unit tests](UnitTests.md) - Writing unit tests for your cards.



Expand Down
16 changes: 8 additions & 8 deletions docs/CustomCardView.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ namespace Example

## Concepts

* [Architecture](docs/Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](docs/CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](docs/CardView.md) - General information about Card Views
* [Memory](docs/Memory.md) - Information on persistence and memory
* [Validation](docs/Validation.md) - Model validation
* [Routing](docs/RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](docs/authentication.md) - Authentication
* [Unit tests](docs/UnitTests.md) - Writing unit tests for your cards.
* [Architecture](Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](CardView.md) - General information about Card Views
* [Memory](Memory.md) - Information on persistence and memory
* [Validation](Validation.md) - Model validation
* [Routing](RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](authentication.md) - Authentication
* [Unit tests](UnitTests.md) - Writing unit tests for your cards.



Expand Down
11 changes: 10 additions & 1 deletion docs/ICardView.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,15 @@ public override async Task<AdaptiveChoice[]> OnSearchChoicesAsync(SearchInvoke s
}
```


## Concepts

* [Architecture](Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](CardView.md) - General information about Card Views
* [Memory](Memory.md) - Information on persistence and memory
* [Validation](Validation.md) - Model validation
* [Routing](RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](authentication.md) - Authentication
* [Unit tests](UnitTests.md) - Writing unit tests for your cards.

![image](https://user-images.githubusercontent.com/17789481/197365048-6a74c3d5-85cd-4c04-a07a-eef2a46e0ddf.png)
16 changes: 8 additions & 8 deletions docs/InstallTools.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ dotnet new install Crazor.Templates

## Concepts

* [Architecture](docs/Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](docs/CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](docs/CardView.md) - General information about Card Views
* [Memory](docs/Memory.md) - Information on persistence and memory
* [Validation](docs/Validation.md) - Model validation
* [Routing](docs/RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](docs/authentication.md) - Authentication
* [Unit tests](docs/UnitTests.md) - Writing unit tests for your cards.
* [Architecture](Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](CardView.md) - General information about Card Views
* [Memory](Memory.md) - Information on persistence and memory
* [Validation](Validation.md) - Model validation
* [Routing](RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](authentication.md) - Authentication
* [Unit tests](UnitTests.md) - Writing unit tests for your cards.

16 changes: 8 additions & 8 deletions docs/Memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ public async virtual Task SaveAppAsync(CancellationToken cancellationToken)

## Concepts

* [Architecture](docs/Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](docs/CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](docs/CardView.md) - General information about Card Views
* [Memory](docs/Memory.md) - Information on persistence and memory
* [Validation](docs/Validation.md) - Model validation
* [Routing](docs/RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](docs/authentication.md) - Authentication
* [Unit tests](docs/UnitTests.md) - Writing unit tests for your cards.
* [Architecture](Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](CardView.md) - General information about Card Views
* [Memory](Memory.md) - Information on persistence and memory
* [Validation](Validation.md) - Model validation
* [Routing](RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](authentication.md) - Authentication
* [Unit tests](UnitTests.md) - Writing unit tests for your cards.



Expand Down
17 changes: 8 additions & 9 deletions docs/RoutingCards.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,14 @@ public void OnLoadRoute(string name, string zip, string city)

## Concepts

* [Architecture](docs/Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](docs/CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](docs/CardView.md) - General information about Card Views
* [Memory](docs/Memory.md) - Information on persistence and memory
* [Validation](docs/Validation.md) - Model validation
* [Routing](docs/RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](docs/authentication.md) - Authentication
* [Unit tests](docs/UnitTests.md) - Writing unit tests for your cards.

* [Architecture](Architecture.md) - Describes overall structure of **Crazor** **application**
* [Card Apps](CardApp.md) - How to create a **CardApp** class to define state and operations against state.
* [Card Views](CardView.md) - General information about Card Views
* [Memory](Memory.md) - Information on persistence and memory
* [Validation](Validation.md) - Model validation
* [Routing](RoutingCards.md) - Information on customizing urls to support deep linking into cards
* [Authentication](authentication.md) - Authentication
* [Unit tests](UnitTests.md) - Writing unit tests for your cards.


![image](https://user-images.githubusercontent.com/17789481/197365048-6a74c3d5-85cd-4c04-a07a-eef2a46e0ddf.png)
Loading

0 comments on commit d61daa7

Please sign in to comment.