File tree Expand file tree Collapse file tree 4 files changed +19
-11
lines changed Expand file tree Collapse file tree 4 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ export default function SiloScimTab() {
9090 path : { tokenId : token . id } ,
9191 query : { silo : siloSelector . silo } ,
9292 } ) ,
93+ resourceKind : 'SCIM token' ,
9394 label : token . id ,
9495 } ) ,
9596 } ,
@@ -234,19 +235,21 @@ function TokenCreatedModal({
234235 onDismiss : ( ) => void
235236} ) {
236237 return (
237- < Modal isOpen onDismiss = { onDismiss } title = "SCIM token created" >
238+ < Modal isOpen onDismiss = { onDismiss } title = "SCIM token created" width = "free" >
238239 < Modal . Section >
239240 < Message
240241 variant = "notice"
241- content = < >
242- This is the only time you’ll see this token. Copy it now and store it securely.
243- </ >
242+ content = {
243+ < div className = "max-w-md" >
244+ You won’t see this token again. Copy it and store it securely.
245+ </ div >
246+ }
244247 />
245248
246249 < div className = "mt-4" >
247250 < div className = "text-sans-md text-raise mb-2" > Bearer Token</ div >
248251 < div className = "text-sans-md text-raise bg-default border-default flex items-stretch rounded border" >
249- < div className = "flex-1 overflow-hidden px-3 py-2.75 text-ellipsis" >
252+ < div className = "flex-1 overflow-hidden py-2.75 pr-5 pl-3 text-nowrap text-ellipsis" >
250253 { token . bearerToken }
251254 </ div >
252255 < div className = "border-default flex w-8 items-center justify-center border-l" >
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ import {
5353 ipRangeLen ,
5454 NotImplemented ,
5555 paginated ,
56+ randomHex ,
5657 requireFleetAdmin ,
5758 requireFleetCollab ,
5859 requireFleetViewer ,
@@ -1903,12 +1904,9 @@ export const handlers = makeHandlers({
19031904 requireFleetCollab ( cookies )
19041905 const silo = lookup . silo ( { silo : query . silo } )
19051906
1906- // Generate a 20-character hex string
1907- const hexString = uuid ( ) . replace ( / - / g, '' ) . slice ( 0 , 20 )
1908-
19091907 const newToken : Json < Api . ScimClientBearerTokenValue > = {
19101908 id : uuid ( ) ,
1911- bearer_token : `oxide-scim-${ hexString } ` ,
1909+ bearer_token : `oxide-scim-${ randomHex ( 40 ) } ` ,
19121910 time_created : new Date ( ) . toISOString ( ) ,
19131911 }
19141912
Original file line number Diff line number Diff line change @@ -422,3 +422,10 @@ export function handleOxqlMetrics({ query }: TimeseriesQuery): Json<OxqlQueryRes
422422 const stateValue = getCpuStateFromQuery ( query )
423423 return getMockOxqlInstanceData ( metricName , stateValue )
424424}
425+
426+ export function randomHex ( length : number ) {
427+ const hexChars = '0123456789abcdef'
428+ return Array . from ( { length } )
429+ . map ( ( ) => hexChars . charAt ( Math . floor ( Math . random ( ) * hexChars . length ) ) )
430+ . join ( '' )
431+ }
Original file line number Diff line number Diff line change @@ -41,9 +41,9 @@ test('Create SCIM token', async ({ page }) => {
4141 await expect ( tokenCreatedModal ) . toBeVisible ( )
4242
4343 // Check that the bearer token is visible and starts with oxide-scim-
44- const bearerTokenDiv = tokenCreatedModal . getByText ( / ^ o x i d e - s c i m - [ a - f 0 - 9 ] { 20 } $ / )
44+ const bearerTokenDiv = tokenCreatedModal . getByText ( / ^ o x i d e - s c i m - [ a - f 0 - 9 ] { 40 } $ / )
4545 await expect ( bearerTokenDiv ) . toBeVisible ( )
46- const warning = tokenCreatedModal . getByText ( 'This is the only ' )
46+ const warning = tokenCreatedModal . getByText ( 'You won’t see this token again ' )
4747 await expect ( warning ) . toBeVisible ( )
4848
4949 // Check that copy button is visible
You can’t perform that action at this time.
0 commit comments