-
Notifications
You must be signed in to change notification settings - Fork 0
GET GUEST TOKEN
The guest token using to provide an authority session for not logoned client. The token required to performing an any query.
At the moment not allowed in query format because require token to backward connection.
Receiving of the guest token implemented via establishing of the BradcastServer
that sending a guest tokens to any one who connecting.
For handling a process of receiving a guest tokens the API provides a GuestTokenProcessor
that fulfill the task in auto mode.
- Implements the
UniformQueries.Executable.Security.AuthQueryProcessor
interface.
The following example shows a way to request guest token via the GuestTokenProcessor
.
// Create the new processor.
var processor = new BaseQueries.GET_GUEST_TOKEN.GuestTokenProcessor();
// Sign up on a callback that occurs when auth operation is finished.
processor.ProcessingFinished += delegate (
UniformQueries.Executable.QueryProcessor _,
bool operationResult,
object message)
{
// Handle result here.
};
// Request a guest token.
processor.TryToReciveTokenAsync(
SERVER_IP,
PIPE_NAME,
AuthorityController.Session.Current.TerminationTokenSource.Token);
- Where the
SERVER_IP
is an ip adress or the name of the computer into a local network. - Where the
PIPE_NAME
is a name of the named pipe started on the server.
The easiest way comparing to manual is using the instructions defined in a RoutingTable
. The partial authorized instructions implements an API to reduce amount of required actions from developer during fulfilling the task.
An idea of the PartialAuthorizedInstruction
is that it holds and manages a guest token an allows to user perform some base queries not required logon.
The following example shows hot to request a guest token by using the PartialAuthorizedInstruction
instance.
// Request a token.
while (!await PAI.TryToGetGuestTokenAsync(CANCELATION_TOKEN))
{
// Await 5s if failed and retry.
await Task.Delay(5000, CANCELATION_TOKEN);
}
- Where the
PAI
is the instance of thePartialAuthorizedInstruction
where described routing to the server. - Where the
CANCELATION_TOKEN
is a token that would be used to stop the async operation.
In case if you use a full authorized routing instructions implemented by the AuthorizedInstruction
then you no need to care about requesting a guest token.
The TryToLogon
handler requests and waits for the token by itself.
But in case if you still have no a params to logon but already require the token the just use an previous example. The AuthorizedInstruction
derived from the PartialAuthorizedInstruction
so it has the same API.
- Donate: Why support the initiative? | Patreon
- Contacts: LinkedIn
- See also: WPF Handler | Uniform Data Operator | Datum Point