ui: Auth Methods- Updates to certificate and empty state in show page (#9895)

* Update Certificate to be monospaced

* Add empty states for claim and list claim mappings

* Update the styling of empty state actions block

* Update mocked PEM certificate format
This commit is contained in:
Kenia 2021-03-18 11:18:23 -04:00 committed by GitHub
parent c7b3bd1915
commit f8ea01e615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 65 additions and 19 deletions

View File

@ -7,7 +7,7 @@
> >
</button> </button>
{{#if this.show}} {{#if this.show}}
<div class="key">{{@item}}</div> <code>{{@item}}</code>
{{else}} {{else}}
<hr /> <hr />
{{/if}} {{/if}}

View File

@ -12,9 +12,11 @@
button.show::before { button.show::before {
@extend %with-visibility-show-icon, %as-pseudo; @extend %with-visibility-show-icon, %as-pseudo;
} }
div.key { code {
background-color: var(--gray-050); background-color: var(--gray-050);
overflow-wrap: anywhere; overflow-wrap: break-word;
max-width: min-content;
padding: 0 12px;
} }
hr { hr {
border: 3px dashed var(--gray-300); border: 3px dashed var(--gray-300);

View File

@ -166,9 +166,9 @@
<hr /> <hr />
{{#if @item.Config.ClaimMappings}}
<section class="claim-mappings"> <section class="claim-mappings">
<h2>Claim Mappings</h2> <h2>Claim Mappings</h2>
{{#if @item.Config.ClaimMappings}}
<p>Use this if the claim you are capturing is singular. When mapped, the values can be any of a number, string, or boolean and will all be stringified when returned.</p> <p>Use this if the claim you are capturing is singular. When mapped, the values can be any of a number, string, or boolean and will all be stringified when returned.</p>
<table> <table>
<thead> <thead>
@ -186,14 +186,32 @@
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
</section> {{else}}
<EmptyState>
<BlockSlot @name="header">
<h2>No claim mappings</h2>
</BlockSlot>
<BlockSlot @name="body">
<p>Use this if the claim you are capturing is singular. When mapped, the values can be any of a number, string, or boolean and will all be stringified when returned.</p>
</BlockSlot>
<BlockSlot @name="actions">
<li class="docs-link">
{{#if (eq @item.Type 'jwt')}}
<a href="{{env 'CONSUL_DOCS_URL'}}/security/acl/auth-methods/jwt#claimmappings" rel="noopener noreferrer" target="_blank">Read the documentation</a>
{{else}}
<a href="{{env 'CONSUL_DOCS_URL'}}/security/acl/auth-methods/oidc#claimmappings" rel="noopener noreferrer" target="_blank">Read the documentation</a>
{{/if}} {{/if}}
</li>
</BlockSlot>
</EmptyState>
{{/if}}
</section>
<hr /> <hr />
{{#if @item.Config.ListClaimMappings}}
<section class="list-claim-mappings"> <section class="list-claim-mappings">
<h2>List Claim Mappings</h2> <h2>List Claim Mappings</h2>
{{#if @item.Config.ListClaimMappings}}
<p>Use this if the claim you are capturing is list-like (such as groups). When mapped, the values can be any of a number, string, or boolean and will all be stringified when returned.</p> <p>Use this if the claim you are capturing is list-like (such as groups). When mapped, the values can be any of a number, string, or boolean and will all be stringified when returned.</p>
<table> <table>
<thead> <thead>
@ -211,7 +229,25 @@
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
{{else}}
<EmptyState>
<BlockSlot @name="header">
<h2>No list claim mappings</h2>
</BlockSlot>
<BlockSlot @name="body">
<p>Use this if the claim you are capturing is list-like (such as groups). When mapped, the values can be any of a number, string, or boolean and will all be stringified when returned.</p>
</BlockSlot>
<BlockSlot @name="actions">
<li class="docs-link">
{{#if (eq @item.Type 'jwt')}}
<a href="{{env 'CONSUL_DOCS_URL'}}/security/acl/auth-methods/jwt#listclaimmappings" rel="noopener noreferrer" target="_blank">Read the documentation</a>
{{else}}
<a href="{{env 'CONSUL_DOCS_URL'}}/security/acl/auth-methods/oidc#listclaimmappings" rel="noopener noreferrer" target="_blank">Read the documentation</a>
{{/if}}
</li>
</BlockSlot>
</EmptyState>
{{/if}}
</section> </section>
{{/if}} {{/if}}
{{/if}}
</div> </div>

View File

@ -28,10 +28,7 @@
%empty-state > ul { %empty-state > ul {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-top: 1em;
margin-top: 1.5em;
padding-top: 0.6em;
border-top: 1px solid;
} }
%empty-state-anchor { %empty-state-anchor {
display: inline-flex; display: inline-flex;

View File

@ -2,9 +2,6 @@
color: $gray-500; color: $gray-500;
background-color: $gray-010; background-color: $gray-010;
} }
%empty-state > ul {
border-color: $gray-300;
}
%empty-state-header { %empty-state-header {
border-bottom: none; border-bottom: none;
} }

View File

@ -1,6 +1,20 @@
${ ${
[1].map(i => { [1].map(i => {
const type = `${fake.helpers.randomize(['kubernetes', 'jwt', 'oidc'])}`; const type = `${fake.helpers.randomize(['kubernetes', 'jwt', 'oidc'])}`;
const cert = `-----BEGIN CERTIFICATE-----
MIIH/TCCBeWgAwIBAgIQaBYE3/M08XHYCnNVmcFBcjANBgkqhkiG9w0BAQsFADBy
MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0b24x
ETAPBgNVBAoMCFNTTCBDb3JwMS4wLAYDVQQDDCVTU0wuY29tIEVWIFNTTCBJbnRl
cm1lZGlhdGUgQ0EgUlNBIFIzMB4XDTIwMDQwMTAwNTgzM1oXDTIxMDcxNjAwNTgz
M1owgb0xCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91
c3RvbjERMA8GA1UECgwIU1NMIENvcnAxFjAUBgNVBAUTDU5WMjAwODE2MTQyNDMx
FDASBgNVBAMMC3d3dy5zc2wuY29tMR0wGwYDVQQPDBRQcml2YXRlIE9yZ2FuaXph
dGlvbjEXMBUGCysGAQQBgjc8AgECDAZOZXZhZGExEzARBgsrBgEEAYI3PAIBAxMC
VVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDHheRkbb1FCc7xRKst
wK0JIGaKY8t7JbS2bQ2b6YIJDgnHuIYHqBrCUV79oelikkokRkFvcvpaKinFHDQH
UpWEI6RUERYmSCg3O8Wi42uOcV2B5ZabmXCkwdxY5Ecl51BbM8UnGdoAGbdNmiRm
SmTjcs+lhMxg4fFY6lBpiEVFiGUjGRR+61R67Lz6U4KJeLNcCm07QwFYKBmpi08g
-----END CERTIFICATE-----`;
let sourceType; let sourceType;
if (type !== 'kubernetes') { if (type !== 'kubernetes') {
@ -20,14 +34,14 @@ ${
case 'kubernetes': case 'kubernetes':
config = { config = {
Host: `https://${fake.internet.ip()}:8443`, Host: `https://${fake.internet.ip()}:8443`,
CACert: `-----BEGIN CERTIFICATE-----${fake.internet.password(1357)}-----END CERTIFICATE-----`, CACert: cert,
ServiceAccountJWT: `eyJhbGciOiJ${fake.internet.password(25)}.eyJ${fake.internet.password(61)}.${fake.internet.password(32)}` ServiceAccountJWT: `eyJhbGciOiJ${fake.internet.password(25)}.eyJ${fake.internet.password(61)}.${fake.internet.password(32)}`
}; };
break; break;
case 'oidc': case 'oidc':
config = { config = {
OIDCDiscoveryURL: `https://${fake.internet.ip()}:8443`, OIDCDiscoveryURL: `https://${fake.internet.ip()}:8443`,
OIDCDiscoveryCACert: `-----BEGIN CERTIFICATE-----${fake.internet.password(1357)}-----END CERTIFICATE-----`, OIDCDiscoveryCACert: cert,
OIDCClientID: `${fake.hacker.noun()}-ID`, OIDCClientID: `${fake.hacker.noun()}-ID`,
OIDCClientSecret: `${fake.hacker.noun()}-secret`, OIDCClientSecret: `${fake.hacker.noun()}-secret`,
BoundAudiences: ["aud_example_0", "aud_example_1"], BoundAudiences: ["aud_example_0", "aud_example_1"],
@ -55,11 +69,11 @@ ${
switch(sourceType) { switch(sourceType) {
case 'JWTValidationPubKeys': case 'JWTValidationPubKeys':
config.JWTValidationPubKeys = `-----BEGIN CERTIFICATE-----${fake.internet.password(1357)}-----END CERTIFICATE-----`; config.JWTValidationPubKeys = cert;
break; break;
case 'JWKSURL': case 'JWKSURL':
config.JWKSURL = `https://${fake.internet.ip()}:8443`; config.JWKSURL = `https://${fake.internet.ip()}:8443`;
config.JWKSCACert = `-----BEGIN CERTIFICATE-----${fake.internet.password(1357)}-----END CERTIFICATE-----`; config.JWKSCACert = cert;
break; break;
case 'OIDCDiscoveryURL': case 'OIDCDiscoveryURL':
config.OIDCDiscoveryURL = `https://${fake.internet.ip()}:8443`; config.OIDCDiscoveryURL = `https://${fake.internet.ip()}:8443`;