mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-23 19:49:13 +02:00
dashboard: improve display of device credentials, allow deletion (#2829)
* dashboard: improve display of device credentials, allow deletion * fix test
This commit is contained in:
parent
c064bc8e0e
commit
838c9e3a3d
8 changed files with 225 additions and 36 deletions
32
authenticate/handlers/webauthn/helpers.go
Normal file
32
authenticate/handlers/webauthn/helpers.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package webauthn
|
||||
|
||||
import "github.com/pomerium/pomerium/pkg/grpc/session"
|
||||
|
||||
func containsString(elements []string, value string) bool {
|
||||
for _, element := range elements {
|
||||
if element == value {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func removeString(elements []string, value string) []string {
|
||||
dup := make([]string, 0, len(elements))
|
||||
for _, element := range elements {
|
||||
if element != value {
|
||||
dup = append(dup, element)
|
||||
}
|
||||
}
|
||||
return dup
|
||||
}
|
||||
|
||||
func removeSessionDeviceCredential(elements []*session.Session_DeviceCredential, id string) []*session.Session_DeviceCredential {
|
||||
dup := make([]*session.Session_DeviceCredential, 0, len(elements))
|
||||
for _, element := range elements {
|
||||
if element.GetId() != id {
|
||||
dup = append(dup, element)
|
||||
}
|
||||
}
|
||||
return dup
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue