You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: security_scheme.go
    path of file: ./repos/ko/vendor/github.com/go-openapi/spec
    
    the code of the file until where you have to start completion: // Copyright 2015 go-swagger maintainers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package spec

import (
	"enc
    
func (s SecurityScheme) MarshalJSON() ([]byte, error) {
	var (
		b1  []byte
		err error
	)

	if s.Type == oauth2 && (s.Flow == "implicit" || s.Flow == "accessCode") {
		// when oauth2 for implicit or accessCode flows, empty AuthorizationURL is added as empty string
		b1, err = json.Marshal(s.SecuritySchemeProps)
	} else {
		// when not oauth2, empty AuthorizationURL should be omitted
		b1, err = json.Marshal(struct {
			Description      string            `json:"description,omitempty"`
			Type             string            `json:"type"`
			Name             string            `json:"name,omitempty"`             // api key
			In               string            `json:"in,omitempty"`               // api key
			Flow             string            `json:"flow,omitempty"`             // oauth2
			AuthorizationURL string            `json:"authorizationUrl,omitempty"` // oauth2
			TokenURL         string            `json:"tokenUrl,omitempty"`         // oauth2
			Scopes           map[string]string `json:"scopes,omitempty"`           // oauth2
		}{
			Description:      s.Description,
			Type:             s.Type,
			Name:             s.Name,
			In:               s.In,
			Flow:             s.Flow,
			AuthorizationURL: s.AuthorizationURL,
			TokenURL:         s.TokenURL,
			Scopes:           s.Scopes,
		})
	}
	if err != nil {
		return nil, err
	}

	b2, err := json.Marshal(s.VendorExtensible)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b1, b2), nil
}