Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Blazor Demo #38

Open
akema-trebla opened this issue May 30, 2022 · 27 comments
Open

Create Blazor Demo #38

akema-trebla opened this issue May 30, 2022 · 27 comments

Comments

@akema-trebla
Copy link
Contributor

It appears there's a lot of interest in an AuthP demo with a Blazor application.

I noticed one of the Discussions (#31), wanted to find out how to do this from a Blazor WASM application in particular.

So with @JonPSmith's blessing, I'll be taking the Example 4 project and converting it into a Blazor application.

I'll be creating

  • A Web API backend project
  • A Blazor WASM hosted project
@JonPSmith
Copy link
Owner

Hi @akema-trebla,

Great to see you doing this!

I just wanted to alert that I am currently improving Example3 (in the dev branch) with a better "sign up / versioning" and "invite user" features. These features / new release and a few other changes will be merged back into main branch in 2 to 4 weeks (hopefully).

I don't want that to cause a problems to you so here are some suggestions:

  • Remove the "sign up" and "invite user" code from your new example - I think that is best way as the focus is on Blazor
  • Copy the Example3 code and store it somewhere - that's messy, but possible.

Anyway, just wanted to let you know. If you have any questions then add a comment to this issue.

@T-Alkathiri
Copy link

T-Alkathiri commented May 31, 2022

It appears there's a lot of interest in an AuthP demo with a Blazor application.

I noticed one of the Discussions (#31), wanted to find out how to do this from a Blazor WASM application in particular.

So with @JonPSmith's blessing, I'll be taking the Example 4 project and converting it into a Blazor application.

I'll be creating

  • A Web API backend project
  • A Blazor WASM hosted project

Hi @akema-trebla,
That will be awesome and appreciated very much.
Thank so much for your effort and time.

Also please have a look at this those 2 libraries they may be very helpful for you
1 - https://github.com/fullstackhero/dotnet-webapi-boilerplate
2 - https://github.com/fullstackhero/blazor-wasm-boilerplate

@akema-trebla
Copy link
Contributor Author

It appears there's a lot of interest in an AuthP demo with a Blazor application.
I noticed one of the Discussions (#31), wanted to find out how to do this from a Blazor WASM application in particular.
So with @JonPSmith's blessing, I'll be taking the Example 4 project and converting it into a Blazor application.
I'll be creating

  • A Web API backend project
  • A Blazor WASM hosted project

Hi @akema-trebla, That will be awesome and appreciated very much. Thank so much for your effort and time.

Also please have a look at this those 2 libraries they may be very helpful for you 1 - https://github.com/fullstackhero/dotnet-webapi-boilerplate 2 - https://github.com/fullstackhero/blazor-wasm-boilerplate

Thanks @T-Alkathiri

I've actually had a look at and contributed to the fullstackhero project in the past.

I've also been able to integrate AuthP in that project.

I was just kinda waiting for @JonPSmith's changes since I was actually already done by the time he mentioned them :-)

@JonPSmith
Copy link
Owner

Hi @akema-trebla,

Version 3.3.0 is out now and merged into the main branch. It has some changes, but its mainly new code. I'm not working on the AuthP at he moment

@akema-trebla
Copy link
Contributor Author

Hi @akema-trebla,

Version 3.3.0 is out now and merged into the main branch. It has some changes, but its mainly new code. I'm not working on the AuthP at he moment

Alright, thanks @JonPSmith

@ebasattend
Copy link

Hi @akema-trebla,
Version 3.3.0 is out now and merged into the main branch. It has some changes, but its mainly new code. I'm not working on the AuthP at he moment

Alright, thanks @JonPSmith

Hi @akema-trebla,

When do you think will you finish with the Blazor example?
I can't wait to see the example!! :)

@akema-trebla
Copy link
Contributor Author

Hi @ebasattend

Sorry for the delay. I actually had to put work on hold for a while.
I resume today and I'll get back to this towards the end of the week.

Cheers!

@ebasattend
Copy link

Hi @akema-trebla,
Any news on this?

@akema-trebla
Copy link
Contributor Author

Hi @ebasattend

I've been quite busy but I've been able to complete the WebApi and it's left with the Blazor WASM side.

I'll submit the pull request as is for now so it gives you a starting reference. Seems I'll be getting some help from @idan-h so hopefully it should be completed soon.

@ebasattend
Copy link

Hello, again guys any news on blazor sample?

@JonPSmith
Copy link
Owner

@akema-trebla has created a PR of the backend part about a month ago, but we agreed that its not worth merging until he has build Blazor part is finished.

@akema-trebla
Copy link
Contributor Author

Thanks @JonPSmith for providing the update. I just noticed you've completed the feature to change claims for the JWT.

I'll take a look and see what changes need to be made so I can add the frontend.

@ebasattend As @JonPSmith stated you can find the backend under the closed PRs as a starting reference. We'd agreed to merge after the frontend was added and after the claims change feature was implemented as well.

I have sometime in the coming week so we should have this sorted out in the coming week. Thanks for your patience.

@JonPSmith
Copy link
Owner

Hi @akema-trebla,

I think you are too busy to complete this large version. I understand your position, as I can only support this library because I have stopped doing client work.

If I don't hear from you in the next week or so I will close this issue as "no planned".

All the best to you and your career.

@akema-trebla
Copy link
Contributor Author

Hi @JonPSmith

Happy new year.

I agree. This has taken longer than even I expected but I do want to do this.

I'll reach out on the PR branch to find out what changes I need to work on so I can do those and then link it to the Blazor frontend.

@Code420SW
Copy link

Before a final decision is made on this issue I would like to explore if I can assist in this effort. I don't know what you have in mind for the Blazor demo, but if any of the following dovetails in, let me know.

I am working on a Blazor Server app (non-public) using a backend API that implements AuthP. The Blazor-side authorization is manifested through a permission-trimmed menu structure that only exposes menu items the user is allowed to access based on AuthP. Unauthorized menu items are not exposed on the browser side so security exposure is minimized.

I know this is pretty high level. Let me know if any of the concepts resonate with your efforts.

@JonPSmith
Copy link
Owner

Hi @akema-trebla,

That's fine. Great that you want to finish this. I just didn't this issue to to be open if nothing was going to happen. I'll keep it open.

@JonPSmith
Copy link
Owner

Hi @Code420SW,

Great that you are building a demo of Blazor with the AuthP library. But I see that you are using Syncfusion, which isn't a open-source. That doesn't mean you can write / tweet about it, but it can't be part of this repro.

@akema-trebla is trying to create a Blazor app from scratch, using the AuthP library. It is a big job but he has built the backend and is now looking at the frontend.

All the best with your project.

@JonPSmith
Copy link
Owner

Rediet Zewdu asked if he could create a Blazor web assembly that uses AuthP library. The answer is no for the following reasons.

  • Blazor web assembly can have parallel database assesses and EF Core’s DbContext isn’t thread-safe – see this document.
  • Blazor web assembly doesn’t support authorization because anyone can alter the code – see this explanation.

You need to have a Blazor Server which runs on a web server and send the date to the front-end. I'm not an expert on Blazor (I'm more a backend coder), but you can look at the Blazor docs.

Also @akema-trebla is building an example Blazor app using the AuthP library, but its a lot of work and he isn't getting paid to do this, so it done in his spare time.

@idan-h
Copy link
Contributor

idan-h commented Jan 22, 2023

Rediet Zewdu asked if he could create a Blazor web assembly that uses AuthP library. The answer is no for the following reasons.

  • Blazor web assembly can have parallel database assesses and EF Core’s DbContext isn’t thread-safe – see this document.
  • Blazor web assembly doesn’t support authorization because anyone can alter the code – see this explanation.

You need to have a Blazor Server which runs on a web server and send the date to the front-end. I'm not an expert on Blazor (I'm more a backend coder), but you can look at the Blazor docs.

Also @akema-trebla is building an example Blazor app using the AuthP library, but its a lot of work and he isn't getting paid to do this, so it done in his spare time.

Hey Jon, ofcourse you can build wasm app with AuthP.

You will need a backend api which would be implemented with the help of AuthP library, and a then make api calls from the client side (wasm) as usual.

The authentication should be implemented with JWT or cookies.

Blazor contains client side auth out of the box, so you don't need to implement that manually.

As I said earlier, we have just created such project at our company. Currently I am swamped so I couldn't start working on a generic example, but I would be glad to help if anyone is working on it.

@zrediet
Copy link

zrediet commented Jan 22, 2023

Rediet Zewdu asked if he could create a Blazor web assembly that uses AuthP library. The answer is no for the following reasons.

  • Blazor web assembly can have parallel database assesses and EF Core’s DbContext isn’t thread-safe – see this document.
  • Blazor web assembly doesn’t support authorization because anyone can alter the code – see this explanation.

You need to have a Blazor Server which runs on a web server and send the date to the front-end. I'm not an expert on Blazor (I'm more a backend coder), but you can look at the Blazor docs.

Also @akema-trebla is building an example Blazor app using the AuthP library, but its a lot of work and he isn't getting paid to do this, so it done in his spare time.

Hey Jon, ofcourse you can build wasm app with AuthP.

You will need a backend api which would be implemented with the help of AuthP library, and a then make api calls from the client side (wasm) as usual.

The authentication should be implemented with JWT or cookies.

Blazor contains client side auth out of the box, so you don't need to implement that manually.

As I said earlier, we have just created such project at our company. Currently I am swamped so I couldn't start working on a generic example, but I would be glad to help if anyone is working on it.

Thank you for your interest to help out. Could you please show me some direction so that I can follow or sample project. Thanks in advance.

@idan-h
Copy link
Contributor

idan-h commented Jan 22, 2023

Rediet Zewdu asked if he could create a Blazor web assembly that uses AuthP library. The answer is no for the following reasons.

  • Blazor web assembly can have parallel database assesses and EF Core’s DbContext isn’t thread-safe – see this document.
  • Blazor web assembly doesn’t support authorization because anyone can alter the code – see this explanation.

You need to have a Blazor Server which runs on a web server and send the date to the front-end. I'm not an expert on Blazor (I'm more a backend coder), but you can look at the Blazor docs.

Also @akema-trebla is building an example Blazor app using the AuthP library, but its a lot of work and he isn't getting paid to do this, so it done in his spare time.

Hey Jon, ofcourse you can build wasm app with AuthP.

You will need a backend api which would be implemented with the help of AuthP library, and a then make api calls from the client side (wasm) as usual.

The authentication should be implemented with JWT or cookies.

Blazor contains client side auth out of the box, so you don't need to implement that manually.

As I said earlier, we have just created such project at our company. Currently I am swamped so I couldn't start working on a generic example, but I would be glad to help if anyone is working on it.

Thank you for your interest to help out. Could you please show me some direction so that I can follow or sample project. Thanks in advance.

As of the backend, you can use the api example from project 2 in the solution.

I don't like all the choices they made here and a lot of code needs to be trimmed down / changed, but it is a good example of wasm blazor capabilities:
https://github.com/fullstackhero/blazor-wasm-boilerplate

@akema-trebla
Copy link
Contributor Author

There's a working API using AuthP here

We just need to create a Blazor frontend for it.

And yes, we can use Blazor WASM as I plan to do.

@idan-h Can we collaborate on the frontend? Or you're too busy?

@idan-h
Copy link
Contributor

idan-h commented Jan 22, 2023

There's a working API using AuthP here

We just need to create a Blazor frontend for it.

And yes, we can use Blazor WASM as I plan to do.

@idan-h Can we collaborate on the frontend? Or you're too busy?

Sure, we can collaborate, I'll help with the general structure of the project and will try to help whenever I have free time.

@akema-trebla
Copy link
Contributor Author

@idan-h What structure do you propose?

@zrediet
Copy link

zrediet commented Jan 23, 2023 via email

@idan-h
Copy link
Contributor

idan-h commented Jan 23, 2023

Clean architecture would be a good fit!

On Mon, Jan 23, 2023, 6:03 PM akema-trebla @.***> wrote:

@idan-h https://github.com/idan-h What structure do you propose?


Reply to this email directly, view it on GitHub
#38 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ALOL2GI6X3RFJWTG2P6U73TWT2MUVANCNFSM5XJ6BKAA
.
You are receiving this because you commented.Message ID:
@.***>

Clean architechture is an overkill for this project IMO, and I like feature slicing better in most cases.

A simple and clean folders of Components, Pages, Services etc in would be sufficient.

We will create services which will be responsible of server calls injected with DI.

I still need to take a look at the api project to see what contracts should be shared between the client and the server.

As for comunication between components (We might not need it, depends if we need to manage general state between components) I would use microsot mvvm toolkit. It has a messenger feature that comes in handy.

We can start by forking the project I sent above and changing the namespace to be in line with the server side (The api) and AuthP library in general. Then I would like to start trimming it down to get the appropriate project structure.

Does it sound good for you guys?

@akema-trebla @zrediet @JonPSmith

@zrediet
Copy link

zrediet commented Jan 24, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants