Exeteres
Exeteres
CC#
Created by blueberriesiftheywerecats on 10/25/2023 in #help
❔ ✅ Jwt auth not working
it is not required to be a url though it can be any string and issuer can also be any string but usually it is a url, yes it is all up to you how to organize this stuff and I already mentioned that it is not required at all
18 replies
CC#
Created by blueberriesiftheywerecats on 10/25/2023 in #help
❔ ✅ Jwt auth not working
without dealing with his credentials
18 replies
CC#
Created by blueberriesiftheywerecats on 10/25/2023 in #help
❔ ✅ Jwt auth not working
yes like something that provides some services for an authenticated user
18 replies
CC#
Created by blueberriesiftheywerecats on 10/25/2023 in #help
❔ ✅ Jwt auth not working
both are not required btw the only thing that is essential for JWT to work is valid signature even expiration date is not required, but highly recommended
18 replies
CC#
Created by blueberriesiftheywerecats on 10/25/2023 in #help
❔ ✅ Jwt auth not working
for consumer of the token issuer is something who creates the token (auth service) and audience (or multiple audiences) is something that should verify the user authentication and claims (roles, for example)
18 replies
CC#
Created by blueberriesiftheywerecats on 10/25/2023 in #help
❔ ✅ Jwt auth not working
it seems that you are not specifying an audience while creating JWT token specify it in new JwtSecurityToken or disable it's validation in options.TokenValidationParameters: ValidateAudience = false
18 replies
CC#
Created by CrosRoad95 on 10/24/2023 in #help
❔ IServiceProvider, scoped services, scopes
you can create multiple scopes and use them simultaneously so each scope has it's own service provider with services of this scope
8 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
you put the bacon in the pan and walk away saying "do something about it" someone else comes along and flips it over, spices it up and cooks it the way they want and then calls you again or doesn't call you at all and your bacon gets picked up by a garbage collector, dead serious
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
and call MoveNext
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
we just create a new instance of state machine
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
so there is no need to save them they are already persisted
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
all local variables of async method are just transformed to fields of the state machine class
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
it transforms your async method to state machine class with single method MoveNext something like
c#
void MoveNext() {
__counter++;
switch (__counter) {
case 0: {
// code before first await
SomeMethodReturningTask().GetAwaiter().OnCompleted(MoveNext);
}
case 1: {
// code after first await
SomeAnotherMethodReturningTask().GetAwaiter().OnCompleted(MoveNext);
}
case 2: {
// code after second await
SomeAnotherAnotherMethodReturningTask().GetAwaiter().OnCompleted(MoveNext);
}
// and so on
}
c#
void MoveNext() {
__counter++;
switch (__counter) {
case 0: {
// code before first await
SomeMethodReturningTask().GetAwaiter().OnCompleted(MoveNext);
}
case 1: {
// code after first await
SomeAnotherMethodReturningTask().GetAwaiter().OnCompleted(MoveNext);
}
case 2: {
// code after second await
SomeAnotherAnotherMethodReturningTask().GetAwaiter().OnCompleted(MoveNext);
}
// and so on
}
so your async method just transforms to regular sync method split by awaits and each part ends by calling the async method, accessing task awaiter and providing MoveNext method as a completion that's very simplified, it's more complicated in real state machine
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
it worth to mention that await has rather "push" semantics it does not "await" nothing by occupying some thread it just subscribes to this task and task will trigger the continuation after it completes (it may not complete) and this continuation will be put to the thread pool and executed in the next available thread by default
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
yes it literally returns Task and passes the execution back to the caller like any other method
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
they have the same meanings as in other languages and they're different but they're integrated so well that most programmers can really not think about it just put await where the Task returns and make the method async 🙂 and it works
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
and works well in most cases
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
yes it does "it just works" 🙂
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
i think you can create your own thread pool or some another scheduler the default thread pool mechanism exists to make it "just work"
214 replies
CC#
Created by joren on 10/25/2023 in #help
❔ Clarification on Async and Task.Run
yep DLL is just a bunch of classes
214 replies