Skip to content

Commit

Permalink
implement requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bmo-at-a9s committed Nov 8, 2023
1 parent 5df1d65 commit 8934661
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1 class="create-endpoint__section-title">{{endpoint.definition.label}} Informa
formControlName="createSystemEndpointField" (change)="toggleCreateSystemEndpoint()"
[ngClass]="{'hide': fixedUrl, 'show': !fixedUrl}">Create a system endpoint (visible to all users)
</mat-checkbox>
<mat-checkbox [disabled]="showCACertField" matInput name="skipSll" formControlName="skipSllField">Skip SSL validation for the endpoint</mat-checkbox>
<mat-checkbox [disabled]="showCACertField" matInput name="skipSSL" formControlName="skipSSLField">Skip SSL validation for the endpoint</mat-checkbox>
<mat-checkbox matInput (change)="toggleCACertField()">Use a CA Certificate for the endpoint</mat-checkbox>
<div [ngClass]="{'create-endpoint__shown': showCACertField}" class="create-endpoint__advanced" spellcheck=false>
<span class="create-endpoint__cacert-title">Specify CA Certificate:</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class CreateEndpointCfStep1Component extends CreateEndpointHelperComponen
this.registerForm = this.fb.group({
nameField: ['', [Validators.required]],
urlField: ['', [Validators.required]],
skipSllField: [false, []],
skipSSLField: [false, []],
ssoAllowedField: [false, []],
// Optional Client ID and Client Secret
clientIDField: ['', []],
Expand All @@ -95,7 +95,7 @@ export class CreateEndpointCfStep1Component extends CreateEndpointHelperComponen
const { subType, type } = this.endpoint.getTypeAndSubtype();

// SSL Setttings
let sslAllow = this.registerForm.value.skipSllField;
let sslAllow = this.registerForm.value.skipSSLField;
if (this.showCACertField) {
sslAllow = false;
}
Expand Down Expand Up @@ -164,10 +164,10 @@ export class CreateEndpointCfStep1Component extends CreateEndpointHelperComponen
toggleCACertField() {
this.showCACertField = !this.showCACertField;
if (this.showCACertField) {
this.lastSkipSSLValue = this.registerForm.value.skipSllField;
this.registerForm.controls.skipSllField.setValue(false);
this.lastSkipSSLValue = this.registerForm.value.skipSSLField;
this.registerForm.controls.skipSSLField.setValue(false);
} else {
this.registerForm.controls.skipSllField.setValue(this.lastSkipSSLValue);
this.registerForm.controls.skipSSLField.setValue(this.lastSkipSSLValue);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h1>{{title}} Setup with Cloud Foundry UAA</h1>
<mat-form-field>
<input matInput formControlName="apiUrl" placeholder="UAA Endpoint Url">
</mat-form-field>
<mat-checkbox matInput formControlName="skipSll">Skip SSL validation for the UAA</mat-checkbox>
<mat-checkbox matInput formControlName="skipSSL">Skip SSL validation for the UAA</mat-checkbox>
<mat-form-field>
<input matInput formControlName="clientId" placeholder="Client ID">
</mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class ConsoleUaaWizardComponent implements OnInit {
uaa_endpoint: this.uaaForm.get('apiUrl').value,
console_client: this.uaaForm.get('clientId').value,
password: this.uaaForm.get('adminPassword').value,
skip_ssl_validation: this.uaaForm.get('skipSll').value,
skip_ssl_validation: this.uaaForm.get('skipSSL').value,
username: this.uaaForm.get('adminUsername').value,
console_client_secret: this.uaaForm.get('clientSecret').value,
use_sso: this.uaaForm.get('useSSO').value,
Expand Down Expand Up @@ -78,7 +78,7 @@ export class ConsoleUaaWizardComponent implements OnInit {
uaa_endpoint: this.uaaForm.get('apiUrl').value,
console_client: this.uaaForm.get('clientId').value,
password: this.uaaForm.get('adminPassword').value,
skip_ssl_validation: this.uaaForm.get('skipSll').value,
skip_ssl_validation: this.uaaForm.get('skipSSL').value,
username: this.uaaForm.get('adminUsername').value,
console_client_secret: this.uaaForm.get('clientSecret').value,
use_sso: this.uaaForm.get('useSSO').value,
Expand Down Expand Up @@ -117,7 +117,7 @@ export class ConsoleUaaWizardComponent implements OnInit {
ngOnInit() {
this.uaaForm = new UntypedFormGroup({
apiUrl: new UntypedFormControl('', [Validators.required as any]),
skipSll: new UntypedFormControl(false),
skipSSL: new UntypedFormControl(false),
clientId: new UntypedFormControl('', [Validators.required as any]),
clientSecret: new UntypedFormControl(''),
adminUsername: new UntypedFormControl('', [Validators.required as any]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h3>Select the type of {{gitTypes[epSubType].label}} to register</h3>
formControlName="createSystemEndpointField" (change)="toggleCreateSystemEndpoint()"
[ngClass]="{'hide': fixedUrl, 'show': !fixedUrl}">Create a system endpoint (visible to all users)
</mat-checkbox>
<mat-checkbox matInput name="skipSll" formControlName="skipSllField"
<mat-checkbox matInput name="skipSSL" formControlName="skipSSLField"
[ngClass]="{'hide': fixedUrl, 'show': !fixedUrl}">Skip SSL validation for the
endpoint
</mat-checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class GitRegistrationComponent extends CreateEndpointHelperComponent impl
selectedType: [defaultSelection, []],
nameField: ['', [Validators.required]],
urlField: ['', [Validators.required]],
skipSllField: [false, []],
skipSSLField: [false, []],
createSystemEndpointField: [true, []],
});
this.updateType();
Expand Down Expand Up @@ -201,7 +201,7 @@ export class GitRegistrationComponent extends CreateEndpointHelperComponent impl
const url: string = this.updateUrlWithSuffix(defn.url || this.registerForm.controls.urlField.value, defn);
// If we're in enterprise mode also assign the skipSSL field, otherwise assume false
const skipSSL = this.registerForm.controls.nameField.value && this.registerForm.controls.urlField.value ?
this.registerForm.controls.skipSllField.value :
this.registerForm.controls.skipSSLField.value :
false;
const createSystemEndpoint = this.registerForm.controls.createSystemEndpointField.value;

Expand Down
11 changes: 6 additions & 5 deletions src/jetstream/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (

defaulHTTPClientTimeout int64
defaulHTTPClientMutatingTimeout int64
defaulHTTPClientCcnnectionTimeout int64
defaulHTTPClientConnectionTimeout int64
defaultDialer net.Dialer
)

Expand All @@ -30,7 +30,7 @@ func initializeHTTPClients(timeout int64, timeoutMutating int64, connectionTimeo
// Store defaut timeouts for when we create a client when a CA Cert is used
defaulHTTPClientTimeout = timeout
defaulHTTPClientMutatingTimeout = timeoutMutating
defaulHTTPClientCcnnectionTimeout = connectionTimeout
defaulHTTPClientConnectionTimeout = connectionTimeout

tr := createTransport(&tls.Config{InsecureSkipVerify: false})
httpClient.Transport = tr
Expand All @@ -50,7 +50,7 @@ func initializeHTTPClients(timeout int64, timeoutMutating int64, connectionTimeo
func createTransport(tlsConfig *tls.Config) *http.Transport {
// Common KeepAlive dialer shared by transports
dial := (&net.Dialer{
Timeout: time.Duration(defaulHTTPClientCcnnectionTimeout) * time.Second,
Timeout: time.Duration(defaulHTTPClientConnectionTimeout) * time.Second,
KeepAlive: 30 * time.Second, // should be less than any proxy connection timeout (typically 2-3 minutes)
}).Dial

Expand Down Expand Up @@ -110,8 +110,9 @@ func (p *portalProxy) getHttpClient(skipSSLValidation bool, caCert string, mutat
}

func getHttpClientWIthCA(caCert string, mutating bool) *http.Client {
rootCAs, _ := x509.SystemCertPool()
if rootCAs == nil {
rootCAs, err := x509.SystemCertPool()

if rootCAs == nil || err != nil {
rootCAs = x509.NewCertPool()
}

Expand Down
6 changes: 3 additions & 3 deletions src/jetstream/plugins/cfapppush/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tem

loggerURL := info.URL
cloneURL := info.URL
skipSLL := false
skipSSL := false

// Apply credentials associated with the endpoint
if len(info.EndpointGUID) != 0 {
Expand All @@ -411,7 +411,7 @@ func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tem
return StratosProject{}, tempDir, errors.New("failed to find endpoint with guid " + info.EndpointGUID)
}

skipSLL = cnsiRecord.SkipSSLValidation
skipSSL = cnsiRecord.SkipSSLValidation

tokenRecord, isTokenFound := cfAppPush.portalProxy.GetCNSITokenRecord(info.EndpointGUID, userGUID)
if isTokenFound {
Expand Down Expand Up @@ -458,7 +458,7 @@ func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tem
LoggerUrl: loggerURL,
Branch: info.Branch,
Commit: info.CommitHash,
SkipSSL: skipSLL,
SkipSSL: skipSSL,
}
info.CommitHash, err = cloneRepository(cloneDetails, clientWebSocket, tempDir)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions src/test-e2e/endpoints/endpoints-register-e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('Endpoints', () => {
register.form.fill({
name: selfSignedEndpoint.name,
url: selfSignedEndpoint.url,
skipsll: false
skipssl: false
});
register.stepper.next();

Expand All @@ -175,7 +175,7 @@ describe('Endpoints', () => {
register.form.fill({
name: validEndpoint.name,
url: validEndpoint.url,
skipsll: true
skipssl: true
});

expect(register.stepper.canNext()).toBeTruthy();
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('Endpoints', () => {
register.form.fill({
name: validEndpoint.name,
url: validEndpoint.url,
skipsll: true
skipssl: true
});

expect(register.stepper.canNext()).toBeTruthy();
Expand Down
2 changes: 1 addition & 1 deletion src/test-e2e/metrics/metrics-registration-e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Metrics', () => {
register.form.fill({
name: 'MetricsTest',
url: spoofMetricsEndpoint,
skipsll: true
skipssl: true
});

register.form.getControlsMap().then(fields => {
Expand Down

0 comments on commit 8934661

Please sign in to comment.