Skip to content

Commit 406931d

Browse files
committed
Fixed REST client sessions.
1 parent fdeca30 commit 406931d

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

Shuttle.Access.RestClient/AccessClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ public async Task<IAccessClient> RegisterSessionAsync(CancellationToken cancella
7474
return this;
7575
}
7676

77-
var response = Sessions.PostAsync(new RegisterSession
77+
var response = await Sessions.PostAsync(new RegisterSession
7878
{
7979
IdentityName = _accessClientOptions.IdentityName,
8080
Password = _accessClientOptions.Password
81-
}).Result;
81+
});
8282

8383
if (!response.IsSuccessStatusCode || response.Content == null)
8484
{

Shuttle.Access.RestClient/AuthenticationHeaderHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
4444

4545
if (client.Token.HasValue)
4646
{
47-
request.Headers.Authorization = new("Bearer", client.Token.Value.ToString("n"));
47+
request.Headers.Authorization = new("Shuttle.Access", $"token={client.Token.Value:D}");
4848
}
4949

5050
return await base.SendAsync(request, cancellationToken);

Shuttle.Access.Vue/src/views/Identity.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<form @submit.prevent="submit" class="sv-form sv-form--sm px-5 pt-20">
33
<div class="sv-title">{{ $t("identity") }}</div>
44
<v-text-field :prepend-icon="`svg:${mdiAccountOutline}`" v-model="state.identityName" :label="$t('identity-name')"
5-
class="mb-2" :error-messages="validation.message('identityName')" autocomplete="off">
5+
class="mb-2" :error-messages="validation.message('identityName')" autocomplete="new">
66
</v-text-field>
77
<v-text-field :prepend-icon="`svg:${mdiShieldOutline}`" v-model="state.password" :label="$t('password')"
88
:icon-end="getPasswordIcon()" icon-end-clickable :append-icon="`svg:${getPasswordIcon()}`"
99
@click:append="togglePasswordIcon" :type="getPasswordType()" :error-messages="validation.message('password')"
10-
autocomplete="off">
10+
autocomplete="new">
1111
</v-text-field>
1212
<div class="flex justify-end mt-4">
1313
<v-btn type="submit" :disabled="busy">{{ $t("save") }}</v-btn>
@@ -65,16 +65,16 @@ const submit = async () => {
6565
busy.value = true;
6666
6767
api
68-
.post < RegisterIdentity > ("v1/identities", {
68+
.post<RegisterIdentity>("v1/identities", {
6969
name: state.identityName,
7070
password: state.password,
7171
system: "system://access"
7272
})
73-
.then(function () {
74-
useAlertStore().requestSent();
75-
})
76-
.finally(() => {
77-
busy.value = false;
78-
});
73+
.then(function () {
74+
useAlertStore().requestSent();
75+
})
76+
.finally(() => {
77+
busy.value = false;
78+
});
7979
}
8080
</script>

Shuttle.Access.WebApi/Endpoints/SessionEndpoints.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public static WebApplication MapSessionEndpoints(this WebApplication app, ApiVer
144144
using (new DatabaseContextScope())
145145
await using (databaseContextFactory.Create())
146146
{
147-
var session = (await sessionQuery.SearchAsync(new DataAccess.Query.Session.Specification().WithToken(token))).FirstOrDefault();
147+
var session = (await sessionQuery.SearchAsync(new DataAccess.Query.Session.Specification().WithToken(token).IncludePermissions())).FirstOrDefault();
148148

149149
return session == null
150150
? Results.BadRequest()

0 commit comments

Comments
 (0)