|
1 | | -@* |
| 1 | +@* |
2 | 2 | Copyright © 2022-Present The Synapse Authors |
3 | 3 |
|
4 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
|
22 | 22 | <tbody> |
23 | 23 | <tr> |
24 | 24 | <td>Name</td> |
25 | | - <td> |
26 | | - <input type="text" value="@authentication.Name" required placeholder="Name" title="The authentication name" class="form-control" |
27 | | - @onchange="async e => await OnPropertyChangedAsync(nameof(authentication.Name), a => a.Name = (string)e.Value!)" /> |
28 | | - </td> |
| 25 | + <td><input type="text" value="@authentication.Name" required placeholder="Name" title="The authentication name" class="form-control" |
| 26 | + @onchange="async e => await OnPropertyChangedAsync(nameof(authentication.Name), a => a.Name = (string)e.Value!)"/></td> |
29 | 27 | </tr> |
30 | 28 | <tr> |
31 | 29 | <td>Scheme</td> |
32 | 30 | <td> |
33 | 31 | <select class="form-select bg-secondary text-white" |
34 | | - @onchange="async e => await OnAuthenticationSchemeChangedAsync(EnumHelper.Parse<AuthenticationScheme>((string)e.Value!))"> |
| 32 | + @onchange="async e => await OnAuthenticationSchemeChangedAsync(EnumHelper.Parse<AuthenticationScheme>((string)e.Value!))"> |
35 | 33 | @foreach (var scheme in Enum.GetValues<AuthenticationScheme>()) |
36 | 34 | { |
37 | 35 | var schemeStr = @EnumHelper.Stringify(scheme); |
|
42 | 40 | </tr> |
43 | 41 | <ExpandableDataRow IsExpanded="true"> |
44 | 42 | <Header> |
45 | | - <td>Properties</td> |
46 | | - <td> |
47 | | - <div class="input-group"> |
48 | | - <div class="input-group-text"> |
49 | | - <input class="form-check-input mt-0 me-2" type="checkbox" value="@useSecretBasedProperties" checked="@useSecretBasedProperties" |
50 | | - @onclick="OnUseSecretBasedPropertiesChanged"> |
51 | | - <label title="Indicates whether or not to load the authentication properties from a secret">Load properties from secret</label> |
52 | | - </div> |
| 43 | + <td>Properties</td> |
| 44 | + <td> |
| 45 | + <div class="input-group"> |
| 46 | + <div class="input-group-text"> |
| 47 | + <input class="form-check-input mt-0 me-2" type="checkbox" value="@useSecretBasedProperties" checked="@useSecretBasedProperties" |
| 48 | + @onclick="OnUseSecretBasedPropertiesChanged"> |
| 49 | + <label title="Indicates whether or not to load the authentication properties from a secret">Load properties from secret</label> |
| 50 | + </div> |
53 | 51 | @if (useSecretBasedProperties) |
54 | 52 | { |
55 | | - <SecretSelector Secrets="Workflow.Secrets" |
| 53 | + <SecretSelector |
| 54 | + Secrets="Workflow.Secrets" |
56 | 55 | Selected="@(((SecretBasedAuthenticationProperties)authentication.Properties).Secret)" |
57 | | - OnChange="async secret => await OnPropertyChangedAsync(nameof(authentication.Properties), a => a.SecretRef = secret)" /> |
| 56 | + OnChange="async secret => await OnPropertyChangedAsync(nameof(authentication.Properties), a => a.SecretRef = secret)"/> |
58 | 57 | } |
59 | | - </div> |
60 | | - </td> |
| 58 | + </div> |
| 59 | + </td> |
61 | 60 | </Header> |
62 | 61 | <Body> |
63 | 62 | @if (!useSecretBasedProperties) |
64 | 63 | { |
65 | | - <td colspan="3"> |
| 64 | + <td colspan="3"> |
66 | 65 | @switch (authentication.Scheme) |
67 | 66 | { |
68 | 67 | case AuthenticationScheme.Basic: |
|
71 | 70 | basic = new(); |
72 | 71 | authentication.Properties = basic; |
73 | 72 | } |
74 | | - <table class="table table-striped"> |
75 | | - <tbody> |
76 | | - <tr> |
77 | | - <td>Username</td> |
78 | | - <td> |
79 | | - <input type="text" value="@basic.Username" required placeholder="Username" title="The username to use to authenticate" class="form-control" |
80 | | - @onchange="async e => await OnAuthenticationPropertiesChangedAsync<BasicAuthenticationProperties>(p => p.Username = (string)e.Value!)" /> |
81 | | - </td> |
82 | | - </tr> |
83 | | - <tr> |
84 | | - <td>Password</td> |
85 | | - <td> |
86 | | - <input type="text" value="@basic.Password" required placeholder="Password" title="The password to use to authenticate" class="form-control" |
87 | | - @onchange="async e => await OnAuthenticationPropertiesChangedAsync<BasicAuthenticationProperties>(p => p.Password = (string)e.Value!)" /> |
88 | | - </td> |
89 | | - </tr> |
90 | | - </tbody> |
91 | | - </table> |
| 73 | + <table class="table table-striped"> |
| 74 | + <tbody> |
| 75 | + <tr> |
| 76 | + <td>Username</td> |
| 77 | + <td><input type="text" value="@basic.Username" required placeholder="Username" title="The username to use to authenticate" class="form-control" |
| 78 | + @onchange="async e => await OnAuthenticationPropertiesChangedAsync<BasicAuthenticationProperties>(p => p.Username = (string)e.Value!)"/></td> |
| 79 | + </tr> |
| 80 | + <tr> |
| 81 | + <td>Password</td> |
| 82 | + <td><input type="text" value="@basic.Password" required placeholder="Password" title="The password to use to authenticate" class="form-control" |
| 83 | + @onchange="async e => await OnAuthenticationPropertiesChangedAsync<BasicAuthenticationProperties>(p => p.Password = (string)e.Value!)"/></td> |
| 84 | + </tr> |
| 85 | + </tbody> |
| 86 | + </table> |
92 | 87 | break; |
93 | 88 | case AuthenticationScheme.Bearer: |
94 | 89 | if (authentication.Properties is not BearerAuthenticationProperties bearer) |
95 | 90 | { |
96 | 91 | bearer = new(); |
97 | 92 | authentication.Properties = bearer; |
98 | 93 | } |
99 | | - <table class="table table-striped"> |
100 | | - <tbody> |
101 | | - <tr> |
102 | | - <td>Token</td> |
103 | | - <td> |
104 | | - <textarea placeholder="Token" title="The token to use to authenticate" class="form-control" |
105 | | - @onchange="async e => await OnPropertyChangedAsync(nameof(authentication.Properties), a => ((BearerAuthenticationProperties)a.Properties).Token = (string)e.Value!)">@bearer.Token</textarea> |
106 | | - </td> |
107 | | - </tr> |
108 | | - </tbody> |
109 | | - </table> |
| 94 | + <table class="table table-striped"> |
| 95 | + <tbody> |
| 96 | + <tr> |
| 97 | + <td>Token</td> |
| 98 | + <td><textarea placeholder="Token" title="The token to use to authenticate" class="form-control" |
| 99 | + @onchange="async e => await OnPropertyChangedAsync(nameof(authentication.Properties), a => ((BearerAuthenticationProperties)a.Properties).Token = (string)e.Value!)">@bearer.Token</textarea></td> |
| 100 | + </tr> |
| 101 | + </tbody> |
| 102 | + </table> |
110 | 103 | break; |
111 | 104 | case AuthenticationScheme.OAuth2: |
112 | 105 | if (authentication.Properties is not OAuth2AuthenticationProperties oauth2) |
|
116 | 109 | } |
117 | 110 | break; |
118 | 111 | default: |
119 | | - <span class="text-danger">The specified authentication scheme '@(EnumHelper.Stringify(authentication.Scheme))' is not supported</span> |
| 112 | + <span class="text-danger">The specified authentication scheme '@(EnumHelper.Stringify(authentication.Scheme))' is not supported</span> |
120 | 113 | break; |
121 | 114 | } |
122 | | - </td> |
| 115 | + </td> |
123 | 116 | } |
124 | 117 | </Body> |
125 | 118 | </ExpandableDataRow> |
|
0 commit comments