Documentation ¶
Overview ¶
Copyright 2017 Google Inc.
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.
Copyright 2017 Google Inc.
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.
Copyright 2017 Google Inc.
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.
Copyright 2017 Google Inc.
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.
Index ¶
- Constants
- Variables
- func AddIndexes(version string) error
- func GetCiphertext(input string) (ciphertext string, mode cipher.Mode, padding cipher.Padding, err error)
- func IsEncrypted(input string) (encrypted bool)
- func JsonToStringArray(fjson string) []string
- func SetApidServices(s apid.Services, l apid.LogService)
- type ApiManagerInterface
- type ApiProduct
- type App
- type AppCredential
- type Attribute
- type CipherManagerInterface
- type Company
- type CompanyDeveloper
- type DbManager
- type DbManagerInterface
- type Developer
- type ErrorResponse
- type KeyErrorResponse
- type KmsCipherManager
Constants ¶
const EncryptAes = "AES"
Variables ¶
var PluginData = apid.PluginData{ Name: "apidApiMetadata", Version: "0.2.0", ExtraData: map[string]interface{}{ "schemaVersion": "0.2.0", }, }
var RegexpEncrypted = regexp.MustCompile(regEncrypted)
Functions ¶
func AddIndexes ¶
func GetCiphertext ¶
func IsEncrypted ¶
func JsonToStringArray ¶
func SetApidServices ¶
func SetApidServices(s apid.Services, l apid.LogService)
Types ¶
type ApiManagerInterface ¶
type ApiManagerInterface interface {
InitAPI()
}
type ApiProduct ¶
type ApiProduct struct { Id string `db:"id"` TenantId string `db:"tenant_id"` Name string `db:"name"` DisplayName string `db:"display_name"` Description string `db:"description"` ApiResources string `db:"api_resources"` ApprovalType string `db:"approval_type"` Scopes string `db:"scopes"` Proxies string `db:"proxies"` Environments string `db:"environments"` Quota string `db:"quota"` QuotaTimeUnit string `db:"quota_time_unit"` QuotaInterval int64 `db:"quota_interval"` CreatedAt string `db:"created_at"` CreatedBy string `db:"created_by"` UpdatedAt string `db:"updated_at"` UpdatedBy string `db:"updated_by"` }
type App ¶
type App struct { Id string `db:"id"` TenantId string `db:"tenant_id"` Name string `db:"name"` DisplayName string `db:"display_name"` AccessType string `db:"access_type"` CallbackUrl string `db:"callback_url"` Status string `db:"status"` AppFamily string `db:"app_family"` CompanyId string `db:"company_id"` DeveloperId string `db:"developer_id"` ParentId string `db:"parent_id"` Type string `db:"type"` CreatedAt string `db:"created_at"` CreatedBy string `db:"created_by"` UpdatedAt string `db:"updated_at"` UpdatedBy string `db:"updated_by"` }
type AppCredential ¶
type AppCredential struct { Id string `db:"id"` TenantId string `db:"tenant_id"` ConsumerSecret string `db:"consumer_secret"` AppId string `db:"app_id"` MethodType string `db:"method_type"` Status string `db:"status"` IssuedAt string `db:"issued_at"` ExpiresAt string `db:"expires_at"` AppStatus string `db:"app_status"` Scopes string `db:"scopes"` CreatedAt string `db:"created_at"` CreatedBy string `db:"created_by"` UpdatedAt string `db:"updated_at"` UpdatedBy string `db:"updated_by"` }
type CipherManagerInterface ¶
type CipherManagerInterface interface { AddOrgs(orgs []string) // If input is encrypted, it decodes the input with base64, // and then decrypt it. Otherwise, original input is returned. // An encrypted input should be ciphertext prepended with algorithm. An unencrypted input can have any other format. // An example input is "{AES/ECB/PKCS5Padding}2jX3V3dQ5xB9C9Zl9sqyo8pmkvVP10rkEVPVhmnLHw4=". TryDecryptBase64(input string, org string) (output string, err error) // It encrypts the input, and then encodes the ciphertext with base64. // The returned string is the base64 encoding of the encrypted input, prepended with algorithm. // An example output is "{AES/ECB/PKCS5Padding}2jX3V3dQ5xB9C9Zl9sqyo8pmkvVP10rkEVPVhmnLHw4=" EncryptBase64(input string, org string, mode cipher.Mode, padding cipher.Padding) (output string, err error) }
type Company ¶
type Company struct { Id string `db:"id"` TenantId string `db:"tenant_id"` Name string `db:"name"` DisplayName string `db:"display_name"` Status string `db:"status"` CreatedAt string `db:"created_at"` CreatedBy string `db:"created_by"` UpdatedAt string `db:"updated_at"` UpdatedBy string `db:"updated_by"` }
type CompanyDeveloper ¶
type CompanyDeveloper struct { TenantId string `db:"tenant_id"` CompanyId string `db:"company_id"` DeveloperId string `db:"developer_id"` Roles string `db:"roles"` CreatedAt string `db:"created_at"` CreatedBy string `db:"created_by"` UpdatedAt string `db:"updated_at"` UpdatedBy string `db:"updated_by"` }
type DbManager ¶
type DbManager struct { Data apid.DataService Db apid.DB DbMux sync.RWMutex CipherManager CipherManagerInterface // contains filtered or unexported fields }
func (*DbManager) GetDbVersion ¶
func (*DbManager) GetKmsAttributes ¶
func (*DbManager) SetDbVersion ¶
type DbManagerInterface ¶
type Developer ¶
type Developer struct { Id string `db:"id"` TenantId string `db:"tenant_id"` UserName string `db:"username"` FirstName string `db:"first_name"` LastName string `db:"last_name"` Password string `db:"password"` Email string `db:"email"` Status string `db:"status"` EncryptedPassword string `db:"encrypted_password"` Salt string `db:"salt"` CreatedAt string `db:"created_at"` CreatedBy string `db:"created_by"` UpdatedAt string `db:"updated_at"` UpdatedBy string `db:"updated_by"` }
type ErrorResponse ¶
type ErrorResponse struct { ResponseCode string `json:"response_code,omitempty"` ResponseMessage string `json:"response_message,omitempty"` StatusCode int `json:"-"` Kind string `json:"kind,omitempty"` }
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type KeyErrorResponse ¶
type KmsCipherManager ¶
type KmsCipherManager struct {
// contains filtered or unexported fields
}
func CreateCipherManager ¶
func CreateCipherManager(client *http.Client, serverUrlBase string) *KmsCipherManager
func (*KmsCipherManager) AddOrgs ¶
func (c *KmsCipherManager) AddOrgs(orgs []string)
func (*KmsCipherManager) EncryptBase64 ¶
func (c *KmsCipherManager) EncryptBase64(input string, org string, mode cipher.Mode, padding cipher.Padding) (output string, err error)
It encrypts the input, and then encodes the ciphertext with base64. The returned string is the base64 encoding of the encrypted input, prepended with algorithm. An example output is "{AES/ECB/PKCS5Padding}2jX3V3dQ5xB9C9Zl9sqyo8pmkvVP10rkEVPVhmnLHw4="
func (*KmsCipherManager) TryDecryptBase64 ¶
func (c *KmsCipherManager) TryDecryptBase64(input string, org string) (output string, err error)
If input is encrypted, it decodes the input with base64, and then decrypt it. Otherwise, original input is returned. An encrypted input should be ciphertext prepended with algorithm. An unencrypted input can have any other format. An example of encrypted input is "{AES/ECB/PKCS5Padding}2jX3V3dQ5xB9C9Zl9sqyo8pmkvVP10rkEVPVhmnLHw4=".