├── .github
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── PULL_REQUEST_TEMPLATE.md
├── code_of_conduct.md
└── workflows
│ ├── pr-build.yml
│ └── publish.yml
├── LICENSE.md
├── README.md
├── VERSION
├── deploy
├── docker
│ ├── .env
│ ├── build-all.bat
│ ├── build-all.sh
│ ├── docker-compose.yml
│ ├── keys
│ │ └── jwks.json
│ └── scripts
│ │ ├── load.sh
│ │ └── save.sh
├── helm
│ ├── .helmignore
│ ├── Chart.yaml
│ ├── keys
│ │ └── jwks.json
│ ├── templates
│ │ ├── api-gateway-service
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ └── service.yaml
│ │ ├── community
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ └── service.yaml
│ │ ├── identity
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── jwt-key-secret.yaml
│ │ │ └── service.yaml
│ │ ├── mailhog
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── ingress.yaml
│ │ │ ├── service.yaml
│ │ │ └── webservice.yaml
│ │ ├── mongodb
│ │ │ ├── config.yaml
│ │ │ ├── service.yaml
│ │ │ ├── statefulset.yaml
│ │ │ └── storage.yaml
│ │ ├── postgres
│ │ │ ├── config.yaml
│ │ │ ├── service.yaml
│ │ │ ├── statefulset.yaml
│ │ │ └── storage.yaml
│ │ ├── rbac
│ │ │ ├── role.yaml
│ │ │ └── rolebinding.yaml
│ │ ├── web
│ │ │ ├── configmap.yaml
│ │ │ ├── deployment.yaml
│ │ │ └── ingress.yaml
│ │ └── workshop
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ └── service.yaml
│ ├── values-pv.yaml
│ ├── values-safe.yaml
│ ├── values-tls.yaml
│ └── values.yaml
├── k8s
│ ├── base
│ │ ├── build-all.sh
│ │ ├── community
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ └── service.yaml
│ │ ├── deploy.sh
│ │ ├── gateway-service
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ └── service.yaml
│ │ ├── identity
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ └── service.yaml
│ │ ├── mailhog
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── ingress.yaml
│ │ │ └── service.yaml
│ │ ├── mongodb
│ │ │ ├── config.yaml
│ │ │ ├── service.yaml
│ │ │ ├── statefulset.yaml
│ │ │ └── storage.yaml
│ │ ├── postgres
│ │ │ ├── config.yaml
│ │ │ ├── service.yaml
│ │ │ ├── statefulset.yaml
│ │ │ └── storage.yaml
│ │ ├── rbac
│ │ │ ├── role.yaml
│ │ │ └── rolebinding.yaml
│ │ ├── web
│ │ │ ├── configmap.yaml
│ │ │ ├── deployment.yaml
│ │ │ └── ingress.yaml
│ │ └── workshop
│ │ │ ├── config.yaml
│ │ │ ├── deployment.yaml
│ │ │ └── service.yaml
│ ├── keys
│ │ └── jwks.json
│ └── minikube
│ │ ├── build-all.sh
│ │ ├── deploy.sh
│ │ ├── mailhog
│ │ └── ingress.yaml
│ │ └── web
│ │ └── ingress.yaml
└── vagrant
│ ├── Vagrantfile
│ ├── crapi.service
│ └── provisioner.sh
├── docs
├── challengeSolutions.md
├── challenges.md
├── crAPI_architecture.md
├── images
│ ├── crapi-architecture.png
│ └── monolith-pic-crapi.png
├── overview.md
├── setup.md
└── troubleshooting.md
├── openapi-spec
└── crapi-openapi-spec.json
├── postman_collections
├── car.mp4
├── crAPI.postman_collection.json
└── crAPI.postman_environment.json
└── services
├── community
├── Dockerfile
├── api
│ ├── auth
│ │ └── token.go
│ ├── config
│ │ ├── Initialize_mongo.go
│ │ └── Initialize_postgres.go
│ ├── controllers
│ │ ├── coupon_controller.go
│ │ ├── home_controller.go
│ │ ├── home_controller_test.go
│ │ └── post_controller.go
│ ├── middlewares
│ │ └── middlewares.go
│ ├── models
│ │ ├── comments.go
│ │ ├── coupon.go
│ │ ├── post.go
│ │ └── user.go
│ ├── responses
│ │ └── json.go
│ ├── router
│ │ └── routes.go
│ ├── seed
│ │ └── seeder.go
│ ├── server.go
│ └── utils
│ │ └── utils.go
├── build-image.bat
├── build-image.sh
├── certs
│ ├── server.crt
│ └── server.key
├── go.mod
├── go.sum
├── health.sh
├── main.go
└── vendor
│ ├── github.com
│ ├── badoux
│ │ └── checkmail
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ └── checkmail.go
│ ├── dgrijalva
│ │ └── jwt-go
│ │ │ ├── .travis.yml
│ │ │ ├── LICENSE
│ │ │ ├── MIGRATION_GUIDE.md
│ │ │ ├── README.md
│ │ │ ├── VERSION_HISTORY.md
│ │ │ ├── claims.go
│ │ │ ├── doc.go
│ │ │ ├── ecdsa.go
│ │ │ ├── ecdsa_utils.go
│ │ │ ├── errors.go
│ │ │ ├── hmac.go
│ │ │ ├── map_claims.go
│ │ │ ├── none.go
│ │ │ ├── parser.go
│ │ │ ├── rsa.go
│ │ │ ├── rsa_pss.go
│ │ │ ├── rsa_utils.go
│ │ │ ├── signing_method.go
│ │ │ └── token.go
│ ├── go-stack
│ │ └── stack
│ │ │ ├── .travis.yml
│ │ │ ├── LICENSE.md
│ │ │ ├── README.md
│ │ │ └── stack.go
│ ├── golang
│ │ └── snappy
│ │ │ ├── AUTHORS
│ │ │ ├── CONTRIBUTORS
│ │ │ ├── LICENSE
│ │ │ ├── README
│ │ │ ├── decode.go
│ │ │ ├── decode_amd64.go
│ │ │ ├── decode_amd64.s
│ │ │ ├── decode_other.go
│ │ │ ├── encode.go
│ │ │ ├── encode_amd64.go
│ │ │ ├── encode_amd64.s
│ │ │ ├── encode_other.go
│ │ │ └── snappy.go
│ ├── google
│ │ └── uuid
│ │ │ ├── .travis.yml
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── CONTRIBUTORS
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── dce.go
│ │ │ ├── doc.go
│ │ │ ├── hash.go
│ │ │ ├── marshal.go
│ │ │ ├── node.go
│ │ │ ├── node_js.go
│ │ │ ├── node_net.go
│ │ │ ├── sql.go
│ │ │ ├── time.go
│ │ │ ├── util.go
│ │ │ ├── uuid.go
│ │ │ ├── version1.go
│ │ │ └── version4.go
│ ├── gorilla
│ │ └── mux
│ │ │ ├── AUTHORS
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── doc.go
│ │ │ ├── middleware.go
│ │ │ ├── mux.go
│ │ │ ├── regexp.go
│ │ │ ├── route.go
│ │ │ └── test_helpers.go
│ ├── jinzhu
│ │ ├── gorm
│ │ │ ├── License
│ │ │ ├── README.md
│ │ │ ├── association.go
│ │ │ ├── callback.go
│ │ │ ├── callback_create.go
│ │ │ ├── callback_delete.go
│ │ │ ├── callback_query.go
│ │ │ ├── callback_query_preload.go
│ │ │ ├── callback_row_query.go
│ │ │ ├── callback_save.go
│ │ │ ├── callback_update.go
│ │ │ ├── dialect.go
│ │ │ ├── dialect_common.go
│ │ │ ├── dialect_mysql.go
│ │ │ ├── dialect_postgres.go
│ │ │ ├── dialect_sqlite3.go
│ │ │ ├── dialects
│ │ │ │ └── postgres
│ │ │ │ │ └── postgres.go
│ │ │ ├── docker-compose.yml
│ │ │ ├── errors.go
│ │ │ ├── field.go
│ │ │ ├── interface.go
│ │ │ ├── join_table_handler.go
│ │ │ ├── logger.go
│ │ │ ├── main.go
│ │ │ ├── model.go
│ │ │ ├── model_struct.go
│ │ │ ├── naming.go
│ │ │ ├── scope.go
│ │ │ ├── search.go
│ │ │ ├── test_all.sh
│ │ │ ├── utils.go
│ │ │ └── wercker.yml
│ │ └── inflection
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── inflections.go
│ │ │ └── wercker.yml
│ ├── joho
│ │ └── godotenv
│ │ │ ├── .travis.yml
│ │ │ ├── LICENCE
│ │ │ ├── README.md
│ │ │ └── godotenv.go
│ ├── klauspost
│ │ └── compress
│ │ │ ├── LICENSE
│ │ │ ├── fse
│ │ │ ├── README.md
│ │ │ ├── bitreader.go
│ │ │ ├── bitwriter.go
│ │ │ ├── bytereader.go
│ │ │ ├── compress.go
│ │ │ ├── decompress.go
│ │ │ └── fse.go
│ │ │ ├── huff0
│ │ │ ├── README.md
│ │ │ ├── bitreader.go
│ │ │ ├── bitwriter.go
│ │ │ ├── bytereader.go
│ │ │ ├── compress.go
│ │ │ ├── decompress.go
│ │ │ └── huff0.go
│ │ │ ├── snappy
│ │ │ ├── AUTHORS
│ │ │ ├── CONTRIBUTORS
│ │ │ ├── LICENSE
│ │ │ ├── README
│ │ │ ├── decode.go
│ │ │ ├── decode_amd64.go
│ │ │ ├── decode_amd64.s
│ │ │ ├── decode_other.go
│ │ │ ├── encode.go
│ │ │ ├── encode_amd64.go
│ │ │ ├── encode_amd64.s
│ │ │ ├── encode_other.go
│ │ │ ├── runbench.cmd
│ │ │ └── snappy.go
│ │ │ └── zstd
│ │ │ ├── README.md
│ │ │ ├── bitreader.go
│ │ │ ├── bitwriter.go
│ │ │ ├── blockdec.go
│ │ │ ├── blockenc.go
│ │ │ ├── blocktype_string.go
│ │ │ ├── bytebuf.go
│ │ │ ├── bytereader.go
│ │ │ ├── decoder.go
│ │ │ ├── decoder_options.go
│ │ │ ├── enc_dfast.go
│ │ │ ├── enc_fast.go
│ │ │ ├── enc_params.go
│ │ │ ├── encoder.go
│ │ │ ├── encoder_options.go
│ │ │ ├── framedec.go
│ │ │ ├── frameenc.go
│ │ │ ├── fse_decoder.go
│ │ │ ├── fse_encoder.go
│ │ │ ├── fse_predefined.go
│ │ │ ├── hash.go
│ │ │ ├── history.go
│ │ │ ├── internal
│ │ │ └── xxhash
│ │ │ │ ├── LICENSE.txt
│ │ │ │ ├── README.md
│ │ │ │ ├── xxhash.go
│ │ │ │ ├── xxhash_amd64.go
│ │ │ │ ├── xxhash_amd64.s
│ │ │ │ ├── xxhash_other.go
│ │ │ │ └── xxhash_safe.go
│ │ │ ├── seqdec.go
│ │ │ ├── seqenc.go
│ │ │ ├── snappy.go
│ │ │ └── zstd.go
│ ├── lib
│ │ └── pq
│ │ │ ├── .travis.sh
│ │ │ ├── .travis.yml
│ │ │ ├── LICENSE.md
│ │ │ ├── README.md
│ │ │ ├── TESTS.md
│ │ │ ├── array.go
│ │ │ ├── buf.go
│ │ │ ├── conn.go
│ │ │ ├── conn_go18.go
│ │ │ ├── connector.go
│ │ │ ├── copy.go
│ │ │ ├── doc.go
│ │ │ ├── encode.go
│ │ │ ├── error.go
│ │ │ ├── hstore
│ │ │ └── hstore.go
│ │ │ ├── krb.go
│ │ │ ├── notice.go
│ │ │ ├── notify.go
│ │ │ ├── oid
│ │ │ ├── doc.go
│ │ │ └── types.go
│ │ │ ├── rows.go
│ │ │ ├── scram
│ │ │ └── scram.go
│ │ │ ├── ssl.go
│ │ │ ├── ssl_permissions.go
│ │ │ ├── ssl_windows.go
│ │ │ ├── url.go
│ │ │ ├── user_posix.go
│ │ │ ├── user_windows.go
│ │ │ └── uuid.go
│ ├── lithammer
│ │ └── shortuuid
│ │ │ ├── .travis.yml
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── alphabet.go
│ │ │ ├── base57.go
│ │ │ └── shortuuid.go
│ ├── pkg
│ │ └── errors
│ │ │ ├── .travis.yml
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── appveyor.yml
│ │ │ ├── errors.go
│ │ │ └── stack.go
│ └── xdg
│ │ ├── scram
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── client.go
│ │ ├── client_conv.go
│ │ ├── common.go
│ │ ├── doc.go
│ │ ├── parse.go
│ │ ├── scram.go
│ │ ├── server.go
│ │ └── server_conv.go
│ │ └── stringprep
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── bidi.go
│ │ ├── doc.go
│ │ ├── error.go
│ │ ├── map.go
│ │ ├── profile.go
│ │ ├── saslprep.go
│ │ ├── set.go
│ │ └── tables.go
│ ├── go.mongodb.org
│ └── mongo-driver
│ │ ├── LICENSE
│ │ ├── bson
│ │ ├── bson.go
│ │ ├── bson_1_8.go
│ │ ├── bsoncodec
│ │ │ ├── bsoncodec.go
│ │ │ ├── byte_slice_codec.go
│ │ │ ├── cond_addr_codec.go
│ │ │ ├── default_value_decoders.go
│ │ │ ├── default_value_encoders.go
│ │ │ ├── doc.go
│ │ │ ├── empty_interface_codec.go
│ │ │ ├── map_codec.go
│ │ │ ├── mode.go
│ │ │ ├── pointer_codec.go
│ │ │ ├── proxy.go
│ │ │ ├── registry.go
│ │ │ ├── slice_codec.go
│ │ │ ├── string_codec.go
│ │ │ ├── struct_codec.go
│ │ │ ├── struct_tag_parser.go
│ │ │ ├── time_codec.go
│ │ │ ├── types.go
│ │ │ └── uint_codec.go
│ │ ├── bsonoptions
│ │ │ ├── byte_slice_codec_options.go
│ │ │ ├── empty_interface_codec_options.go
│ │ │ ├── map_codec_options.go
│ │ │ ├── slice_codec_options.go
│ │ │ ├── string_codec_options.go
│ │ │ ├── struct_codec_options.go
│ │ │ ├── time_codec_options.go
│ │ │ └── uint_codec_options.go
│ │ ├── bsonrw
│ │ │ ├── copier.go
│ │ │ ├── doc.go
│ │ │ ├── extjson_parser.go
│ │ │ ├── extjson_reader.go
│ │ │ ├── extjson_tables.go
│ │ │ ├── extjson_wrappers.go
│ │ │ ├── extjson_writer.go
│ │ │ ├── json_scanner.go
│ │ │ ├── mode.go
│ │ │ ├── reader.go
│ │ │ ├── value_reader.go
│ │ │ ├── value_writer.go
│ │ │ └── writer.go
│ │ ├── bsontype
│ │ │ └── bsontype.go
│ │ ├── decoder.go
│ │ ├── doc.go
│ │ ├── encoder.go
│ │ ├── marshal.go
│ │ ├── primitive
│ │ │ ├── decimal.go
│ │ │ ├── objectid.go
│ │ │ └── primitive.go
│ │ ├── primitive_codecs.go
│ │ ├── raw.go
│ │ ├── raw_element.go
│ │ ├── raw_value.go
│ │ ├── registry.go
│ │ ├── types.go
│ │ └── unmarshal.go
│ │ ├── event
│ │ └── monitoring.go
│ │ ├── internal
│ │ ├── const.go
│ │ ├── error.go
│ │ └── semaphore.go
│ │ ├── mongo
│ │ ├── batch_cursor.go
│ │ ├── bulk_write.go
│ │ ├── bulk_write_models.go
│ │ ├── change_stream.go
│ │ ├── change_stream_deployment.go
│ │ ├── client.go
│ │ ├── client_encryption.go
│ │ ├── collection.go
│ │ ├── crypt_retrievers.go
│ │ ├── cursor.go
│ │ ├── database.go
│ │ ├── doc.go
│ │ ├── errors.go
│ │ ├── index_options_builder.go
│ │ ├── index_view.go
│ │ ├── mongo.go
│ │ ├── mongocryptd.go
│ │ ├── options
│ │ │ ├── aggregateoptions.go
│ │ │ ├── autoencryptionoptions.go
│ │ │ ├── bulkwriteoptions.go
│ │ │ ├── changestreamoptions.go
│ │ │ ├── clientencryptionoptions.go
│ │ │ ├── clientoptions.go
│ │ │ ├── clientoptions_1_10.go
│ │ │ ├── clientoptions_1_9.go
│ │ │ ├── collectionoptions.go
│ │ │ ├── countoptions.go
│ │ │ ├── datakeyoptions.go
│ │ │ ├── dboptions.go
│ │ │ ├── deleteoptions.go
│ │ │ ├── distinctoptions.go
│ │ │ ├── encryptoptions.go
│ │ │ ├── estimatedcountoptions.go
│ │ │ ├── findoptions.go
│ │ │ ├── gridfsoptions.go
│ │ │ ├── indexoptions.go
│ │ │ ├── insertoptions.go
│ │ │ ├── listcollectionsoptions.go
│ │ │ ├── listdatabasesoptions.go
│ │ │ ├── mongooptions.go
│ │ │ ├── replaceoptions.go
│ │ │ ├── runcmdoptions.go
│ │ │ ├── sessionoptions.go
│ │ │ ├── transactionoptions.go
│ │ │ └── updateoptions.go
│ │ ├── readconcern
│ │ │ └── readconcern.go
│ │ ├── readpref
│ │ │ ├── mode.go
│ │ │ ├── options.go
│ │ │ └── readpref.go
│ │ ├── results.go
│ │ ├── session.go
│ │ ├── single_result.go
│ │ ├── util.go
│ │ └── writeconcern
│ │ │ └── writeconcern.go
│ │ ├── tag
│ │ └── tag.go
│ │ ├── version
│ │ └── version.go
│ │ └── x
│ │ ├── bsonx
│ │ ├── array.go
│ │ ├── bsoncore
│ │ │ ├── bsoncore.go
│ │ │ ├── document.go
│ │ │ ├── document_sequence.go
│ │ │ ├── element.go
│ │ │ ├── tables.go
│ │ │ └── value.go
│ │ ├── constructor.go
│ │ ├── document.go
│ │ ├── element.go
│ │ ├── mdocument.go
│ │ ├── primitive_codecs.go
│ │ ├── registry.go
│ │ └── value.go
│ │ └── mongo
│ │ └── driver
│ │ ├── DESIGN.md
│ │ ├── address
│ │ └── addr.go
│ │ ├── auth
│ │ ├── auth.go
│ │ ├── cred.go
│ │ ├── default.go
│ │ ├── doc.go
│ │ ├── gssapi.go
│ │ ├── gssapi_not_enabled.go
│ │ ├── gssapi_not_supported.go
│ │ ├── internal
│ │ │ └── gssapi
│ │ │ │ ├── gss.go
│ │ │ │ ├── gss_wrapper.c
│ │ │ │ ├── gss_wrapper.h
│ │ │ │ ├── sspi.go
│ │ │ │ ├── sspi_wrapper.c
│ │ │ │ └── sspi_wrapper.h
│ │ ├── mongodbcr.go
│ │ ├── plain.go
│ │ ├── sasl.go
│ │ ├── scram.go
│ │ ├── util.go
│ │ └── x509.go
│ │ ├── batch_cursor.go
│ │ ├── batches.go
│ │ ├── compression.go
│ │ ├── connstring
│ │ └── connstring.go
│ │ ├── crypt.go
│ │ ├── description
│ │ ├── description.go
│ │ ├── feature.go
│ │ ├── server.go
│ │ ├── server_kind.go
│ │ ├── server_selector.go
│ │ ├── topology.go
│ │ ├── topology_kind.go
│ │ ├── version.go
│ │ └── version_range.go
│ │ ├── dns
│ │ └── dns.go
│ │ ├── driver.go
│ │ ├── errors.go
│ │ ├── legacy.go
│ │ ├── list_collections_batch_cursor.go
│ │ ├── mongocrypt
│ │ ├── binary.go
│ │ ├── errors.go
│ │ ├── errors_not_enabled.go
│ │ ├── mongocrypt.go
│ │ ├── mongocrypt_context.go
│ │ ├── mongocrypt_context_not_enabled.go
│ │ ├── mongocrypt_kms_context.go
│ │ ├── mongocrypt_kms_context_not_enabled.go
│ │ ├── mongocrypt_not_enabled.go
│ │ ├── options
│ │ │ ├── mongocrypt_context_options.go
│ │ │ ├── mongocrypt_options.go
│ │ │ └── provider_options.go
│ │ └── state.go
│ │ ├── operation.go
│ │ ├── operation
│ │ ├── abort_transaction.go
│ │ ├── abort_transaction.toml
│ │ ├── aggregate.go
│ │ ├── aggregate.toml
│ │ ├── command.go
│ │ ├── commit_transaction.go
│ │ ├── commit_transaction.toml
│ │ ├── count.go
│ │ ├── count.toml
│ │ ├── createIndexes.go
│ │ ├── createIndexes.toml
│ │ ├── delete.go
│ │ ├── delete.toml
│ │ ├── distinct.go
│ │ ├── distinct.toml
│ │ ├── drop_collection.go
│ │ ├── drop_collection.toml
│ │ ├── drop_database.go
│ │ ├── drop_database.toml
│ │ ├── drop_indexes.go
│ │ ├── drop_indexes.toml
│ │ ├── end_sessions.go
│ │ ├── end_sessions.toml
│ │ ├── find.go
│ │ ├── find.toml
│ │ ├── find_and_modify.go
│ │ ├── find_and_modify.toml
│ │ ├── insert.go
│ │ ├── insert.toml
│ │ ├── ismaster.go
│ │ ├── listDatabases.go
│ │ ├── listDatabases.toml
│ │ ├── list_collections.go
│ │ ├── list_collections.toml
│ │ ├── list_indexes.go
│ │ ├── list_indexes.toml
│ │ ├── operation.go
│ │ ├── update.go
│ │ └── update.toml
│ │ ├── operation_legacy.go
│ │ ├── session
│ │ ├── client_session.go
│ │ ├── cluster_clock.go
│ │ ├── options.go
│ │ ├── server_session.go
│ │ └── session_pool.go
│ │ ├── topology
│ │ ├── DESIGN.md
│ │ ├── connection.go
│ │ ├── connection_legacy.go
│ │ ├── connection_legacy_command_metadata.go
│ │ ├── connection_options.go
│ │ ├── errors.go
│ │ ├── fsm.go
│ │ ├── pool.go
│ │ ├── resource_pool.go
│ │ ├── server.go
│ │ ├── server_options.go
│ │ ├── topology.go
│ │ ├── topology_options.go
│ │ ├── topology_options_1_10.go
│ │ └── topology_options_1_9.go
│ │ ├── uuid
│ │ └── uuid.go
│ │ └── wiremessage
│ │ └── wiremessage.go
│ ├── golang.org
│ └── x
│ │ ├── crypto
│ │ ├── AUTHORS
│ │ ├── CONTRIBUTORS
│ │ ├── LICENSE
│ │ ├── PATENTS
│ │ ├── bcrypt
│ │ │ ├── base64.go
│ │ │ └── bcrypt.go
│ │ ├── blowfish
│ │ │ ├── block.go
│ │ │ ├── cipher.go
│ │ │ └── const.go
│ │ └── pbkdf2
│ │ │ └── pbkdf2.go
│ │ ├── sync
│ │ ├── AUTHORS
│ │ ├── CONTRIBUTORS
│ │ ├── LICENSE
│ │ ├── PATENTS
│ │ └── semaphore
│ │ │ └── semaphore.go
│ │ └── text
│ │ ├── AUTHORS
│ │ ├── CONTRIBUTORS
│ │ ├── LICENSE
│ │ ├── PATENTS
│ │ ├── transform
│ │ └── transform.go
│ │ └── unicode
│ │ └── norm
│ │ ├── composition.go
│ │ ├── forminfo.go
│ │ ├── input.go
│ │ ├── iter.go
│ │ ├── normalize.go
│ │ ├── readwriter.go
│ │ ├── tables10.0.0.go
│ │ ├── tables11.0.0.go
│ │ ├── tables12.0.0.go
│ │ ├── tables9.0.0.go
│ │ ├── transform.go
│ │ └── trie.go
│ └── modules.txt
├── docker-database.yml
├── gateway-service
├── Dockerfile
├── build-image.bat
├── build-image.sh
├── go.mod
├── go.sum
├── main.go
├── server.crt
└── server.key
├── gencert.sh
├── identity
├── .env
├── .java-version
├── Dockerfile
├── build-image.bat
├── build-image.sh
├── build.gradle.kts
├── entrypoint.sh
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── health.sh
├── jwks.json
├── settings.gradle.kts
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── crapi
│ │ │ ├── CRAPIBootApplication.java
│ │ │ ├── config
│ │ │ ├── InitialDataConfig.java
│ │ │ ├── JwtAuthEntryPoint.java
│ │ │ ├── JwtAuthTokenFilter.java
│ │ │ ├── JwtProvider.java
│ │ │ ├── MailConfiguration.java
│ │ │ ├── MailHogConfiguration.java
│ │ │ ├── SSLConfig.java
│ │ │ └── WebSecurityConfig.java
│ │ │ ├── constant
│ │ │ ├── TestUsers.java
│ │ │ └── UserMessage.java
│ │ │ ├── controller
│ │ │ ├── AuthController.java
│ │ │ ├── ChangeEmailController.java
│ │ │ ├── ChangePhoneController.java
│ │ │ ├── HealthCheckController.java
│ │ │ ├── ManagementControlller.java
│ │ │ ├── ProfileController.java
│ │ │ ├── UserController.java
│ │ │ └── VehicleController.java
│ │ │ ├── entity
│ │ │ ├── ChangeEmailRequest.java
│ │ │ ├── ChangePhoneRequest.java
│ │ │ ├── Otp.java
│ │ │ ├── ProfileVideo.java
│ │ │ ├── User.java
│ │ │ ├── UserDetails.java
│ │ │ ├── UserPrinciple.java
│ │ │ ├── VehicleCompany.java
│ │ │ ├── VehicleDetails.java
│ │ │ ├── VehicleLocation.java
│ │ │ └── VehicleModel.java
│ │ │ ├── enums
│ │ │ ├── EFuelType.java
│ │ │ ├── ERole.java
│ │ │ └── EStatus.java
│ │ │ ├── exception
│ │ │ ├── CRAPIExceptionHandler.java
│ │ │ ├── EntityNotFoundException.java
│ │ │ ├── ExceptionHandler.java
│ │ │ └── IOExceptionHandler.java
│ │ │ ├── model
│ │ │ ├── ApiKeyResponse.java
│ │ │ ├── CRAPIResponse.java
│ │ │ ├── ChangeEmailForm.java
│ │ │ ├── ChangePhoneForm.java
│ │ │ ├── DashboardResponse.java
│ │ │ ├── ErrorDetails.java
│ │ │ ├── ForgetPassword.java
│ │ │ ├── JwtResponse.java
│ │ │ ├── JwtTokenForm.java
│ │ │ ├── LockAccountForm.java
│ │ │ ├── LoginForm.java
│ │ │ ├── LoginWithEmailToken.java
│ │ │ ├── OtpForm.java
│ │ │ ├── SeedUser.java
│ │ │ ├── SignUpForm.java
│ │ │ ├── UnlockAccountForm.java
│ │ │ ├── VehicleForm.java
│ │ │ ├── VehicleLocationResponse.java
│ │ │ ├── VehicleOwnership.java
│ │ │ └── VideoForm.java
│ │ │ ├── repository
│ │ │ ├── ChangeEmailRepository.java
│ │ │ ├── ChangePhoneRepository.java
│ │ │ ├── OtpRepository.java
│ │ │ ├── ProfileVideoRepository.java
│ │ │ ├── UserDetailsRepository.java
│ │ │ ├── UserRepository.java
│ │ │ ├── VehicleCompanyRepository.java
│ │ │ ├── VehicleDetailsRepository.java
│ │ │ ├── VehicleLocationRepository.java
│ │ │ └── VehicleModelRepository.java
│ │ │ ├── service
│ │ │ ├── Impl
│ │ │ │ ├── OtpServiceImpl.java
│ │ │ │ ├── ProfileServiceImpl.java
│ │ │ │ ├── UserDetailsServiceImpl.java
│ │ │ │ ├── UserRegistrationServiceImpl.java
│ │ │ │ ├── UserServiceImpl.java
│ │ │ │ ├── VehicleOwnershipServiceImpl.java
│ │ │ │ └── VehicleServiceImpl.java
│ │ │ ├── OtpService.java
│ │ │ ├── ProfileService.java
│ │ │ ├── UserRegistrationService.java
│ │ │ ├── UserService.java
│ │ │ ├── VehicleOwnershipService.java
│ │ │ └── VehicleService.java
│ │ │ └── utils
│ │ │ ├── ApiKeyGenerator.java
│ │ │ ├── BashCommand.java
│ │ │ ├── EmailTokenGenerator.java
│ │ │ ├── GenerateVIN.java
│ │ │ ├── MailBody.java
│ │ │ ├── OTPGenerator.java
│ │ │ ├── ProfileValidator.java
│ │ │ ├── SMTPMailServer.java
│ │ │ ├── UserData.java
│ │ │ └── VehicleLocationData.java
│ └── resources
│ │ ├── application.properties
│ │ ├── certs
│ │ ├── keystore.sh
│ │ ├── server.crt
│ │ ├── server.key
│ │ ├── server.keystore
│ │ └── server.p12
│ │ └── logback.xml
│ └── test
│ └── java
│ └── com
│ └── crapi
│ └── service
│ └── Impl
│ ├── OtpServiceImplTest.java
│ ├── ProfileServiceImplTest.java
│ ├── UserDetailsServiceImplTest.java
│ ├── UserRegistrationServiceImplTest.java
│ ├── UserServiceImplTest.java
│ └── VehicleServiceImplTest.java
├── mailhog
├── Dockerfile
├── build-image.bat
└── build-image.sh
├── web
├── .prettierignore
├── .prettierrc
├── Dockerfile
├── build-image.bat
├── build-image.sh
├── certs
│ ├── server.crt
│ └── server.key
├── nginx-wrapper.sh
├── nginx.conf.template
├── nginx.ssl.conf.template
├── package-lock.json
├── package.json
├── public
│ ├── .env
│ ├── images
│ │ ├── audi-rs7.jpg
│ │ ├── bmw-5.jpg
│ │ ├── favicon.ico
│ │ ├── hyundai-creta.jpg
│ │ ├── lamborghini-aventador.jpg
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── mercedesbenz-gla.jpg
│ │ ├── mgmotor-hectorplus.jpg
│ │ ├── seat.svg
│ │ └── wheel.svg
│ ├── index.html
│ ├── manifest.json
│ └── robots.txt
├── src
│ ├── actions
│ │ ├── communityActions.ts
│ │ ├── mechanicActions.ts
│ │ ├── profileActions.ts
│ │ ├── shopActions.ts
│ │ ├── userActions.ts
│ │ └── vehicleActions.ts
│ ├── assets
│ │ └── default_profile_pic.png
│ ├── components
│ │ ├── changeEmail
│ │ │ └── changeEmail.tsx
│ │ ├── changePhoneNumber
│ │ │ └── changePhoneNumber.tsx
│ │ ├── contactMechanic
│ │ │ └── contactMechanic.tsx
│ │ ├── dashboard
│ │ │ ├── dashboard.css
│ │ │ └── dashboard.tsx
│ │ ├── emailForm
│ │ │ └── emailForm.tsx
│ │ ├── forgotPassword
│ │ │ ├── forgotPassword.css
│ │ │ └── forgotPassword.tsx
│ │ ├── forum
│ │ │ ├── forum.tsx
│ │ │ └── style.css
│ │ ├── layout
│ │ │ ├── layout.css
│ │ │ └── layout.tsx
│ │ ├── login
│ │ │ ├── login.css
│ │ │ └── login.tsx
│ │ ├── mechanicDashboard
│ │ │ └── mechanicDashboard.tsx
│ │ ├── mechanicServiceRequest
│ │ │ └── mechanicServiceRequest.tsx
│ │ ├── navBar
│ │ │ ├── nav.css
│ │ │ └── navBar.tsx
│ │ ├── newEmailForm
│ │ │ └── newEmailForm.tsx
│ │ ├── newPhoneNumberForm
│ │ │ └── newPhoneNumberForm.js
│ │ ├── newPost
│ │ │ └── newPost.tsx
│ │ ├── order
│ │ │ ├── order.tsx
│ │ │ └── styles.css
│ │ ├── otpChangePhoneForm
│ │ │ └── otpChangePhoneForm.tsx
│ │ ├── otpForm
│ │ │ └── otpForm.tsx
│ │ ├── pastOrders
│ │ │ ├── pastOrders.tsx
│ │ │ └── styles.css
│ │ ├── post
│ │ │ ├── post.tsx
│ │ │ └── style.css
│ │ ├── profile
│ │ │ ├── profile.css
│ │ │ └── profile.tsx
│ │ ├── resetPassword
│ │ │ └── resetPassword.tsx
│ │ ├── serviceReport
│ │ │ └── serviceReport.tsx
│ │ ├── shop
│ │ │ ├── shop.tsx
│ │ │ └── styles.css
│ │ ├── signup
│ │ │ └── signup.tsx
│ │ ├── tokenForm
│ │ │ └── tokenForm.tsx
│ │ ├── unlock
│ │ │ ├── unlock.css
│ │ │ └── unlock.tsx
│ │ ├── vehicleServiceDashboard
│ │ │ └── vehicleServiceDashboard.tsx
│ │ └── verifyVehicle
│ │ │ └── verifyVehicle.tsx
│ ├── config.ts
│ ├── config.ts.template
│ ├── constants
│ │ ├── APIConstant.ts
│ │ ├── actionTypes.ts
│ │ ├── constants.ts
│ │ ├── messages.ts
│ │ ├── responseTypes.ts
│ │ └── roleTypes.ts
│ ├── containers
│ │ ├── contactMechanic
│ │ │ └── contactMechanic.tsx
│ │ ├── dashboard
│ │ │ └── dashboard.js
│ │ ├── emailForm
│ │ │ └── emailForm.js
│ │ ├── forum
│ │ │ └── forum.js
│ │ ├── login
│ │ │ └── login.js
│ │ ├── mechanicDashboard
│ │ │ └── mechanicDashboard.tsx
│ │ ├── mechanicServiceRequest
│ │ │ └── mechanicServiceRequest.tsx
│ │ ├── newEmailForm
│ │ │ └── newEmailForm.js
│ │ ├── newPhoneNumberForm
│ │ │ └── newPhoneNumberForm.js
│ │ ├── newPost
│ │ │ └── newPost.js
│ │ ├── order
│ │ │ └── order.js
│ │ ├── otpForm
│ │ │ └── otpForm.js
│ │ ├── otpPhoneChangeForm
│ │ │ └── otpPhoneChangeForm.js
│ │ ├── pastOrders
│ │ │ └── pastOrders.js
│ │ ├── post
│ │ │ └── post.js
│ │ ├── profile
│ │ │ └── profile.tsx
│ │ ├── resetPassword
│ │ │ └── resetPassword.js
│ │ ├── serviceReport
│ │ │ └── serviceReport.tsx
│ │ ├── shop
│ │ │ └── shop.js
│ │ ├── signup
│ │ │ └── signup.js
│ │ ├── tokenForm
│ │ │ └── tokenForm.js
│ │ ├── unlock
│ │ │ └── unlock.js
│ │ ├── vehicleServiceDashboard
│ │ │ └── vehicleServiceDashboard.tsx
│ │ └── verifyVehicle
│ │ │ └── verifyVehicle.js
│ ├── index.css
│ ├── index.tsx
│ ├── middleware
│ │ └── index.ts
│ ├── react-app-env.d.ts
│ ├── reducers
│ │ ├── communityReducer.ts
│ │ ├── profileReducer.ts
│ │ ├── rootReducer.ts
│ │ ├── shopReducer.ts
│ │ ├── userReducer.ts
│ │ └── vehicleReducer.ts
│ ├── sagas
│ │ ├── communitySaga.ts
│ │ ├── index.ts
│ │ ├── mechanicSaga.ts
│ │ ├── profileSaga.ts
│ │ ├── shopSaga.ts
│ │ ├── userSaga.ts
│ │ └── vehicleSaga.ts
│ ├── serviceWorker.js
│ ├── tsconfig.json
│ ├── types
│ │ └── action.ts
│ └── utils.ts
├── tsconfig.json
└── webpack.config.js
└── workshop
├── .dockerignore
├── .env
├── Dockerfile
├── __init__.py
├── build-image.bat
├── build-image.sh
├── certs
├── server.crt
└── server.key
├── core
├── __init__.py
└── management
│ ├── __init__.py
│ └── commands
│ └── seed_database.py
├── crapi
├── __init__.py
├── admin.py
├── apps.py
├── mechanic
│ ├── __init__.py
│ ├── models.py
│ ├── serializers.py
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── merchant
│ ├── __init__.py
│ ├── serializers.py
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── migrations
│ ├── 0001_initial.py
│ ├── 0002_order_transaction_id.py
│ ├── 0003_alter_appliedcoupon_id_alter_mechanic_id_and_more.py
│ ├── 0004_alter_servicerequest_status_servicecomment.py
│ └── __init__.py
├── models.py
├── shop
│ ├── __init__.py
│ ├── models.py
│ ├── serializers.py
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── tests.py
├── urls.py
└── user
│ ├── __init__.py
│ ├── models.py
│ ├── sapps.py
│ ├── serializers.py
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── crapi_site
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
├── dev-requirements.txt
├── health.sh
├── manage.py
├── requirements.txt
├── runner.sh
├── setup.py
└── utils
├── __init__.py
├── helper.py
├── jwt.py
├── logging.py
├── messages.py
├── mock_methods.py
└── return-qr-code.png
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Report a bug
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior.
15 | If applicable, add screenshots to help explain your problem.
16 |
17 | **Expected behavior**
18 | A clear and concise description of what you expected to happen.
19 |
20 | **Runtime Environment**
21 | Sytem/Environemnt information (e.g Output of docker -v and uname -a)
22 |
23 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an enhancement/feature for this project
4 | title: ''
5 | labels: enhancement
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what you are trying to solve.
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives if any you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context/screenshots/rough sketchs about the feature request here.
--------------------------------------------------------------------------------
/VERSION:
--------------------------------------------------------------------------------
1 | 1.1.2
2 |
--------------------------------------------------------------------------------
/deploy/docker/.env:
--------------------------------------------------------------------------------
1 | IDENTITY_SERVER_PORT=8080
2 | COMMUNITY_SERVER_PORT=8087
3 | WORKSHOP_SERVER_PORT=8000
4 | ENABLE_SHELL_INJECTION=false
5 | ENABLE_LOG4J=false
6 | LISTEN_IP="127.0.0.1"
7 | TLS_ENABLED=true
8 | VERSION=latest
9 | LOG_LEVEL=INFO
--------------------------------------------------------------------------------
/deploy/docker/build-all.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d services
3 | set "VERSION=latest"
4 | for /F "delims=" %%a in ('dir /b build-image.bat /s') do call "%%a"
--------------------------------------------------------------------------------
/deploy/docker/build-all.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Licensed under the Apache License, Version 2.0 (the “License”);
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an “AS IS” BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | set -x
17 | set -e
18 | cd "$(dirname $0)"
19 | scripts=$(find ../../services/ -name 'build-image*.sh')
20 | for script in ${scripts}
21 | do
22 | echo "Executing $script"
23 | bash -x "$script"
24 | done
25 |
--------------------------------------------------------------------------------
/deploy/docker/scripts/load.sh:
--------------------------------------------------------------------------------
1 | docker load -i mailhog.tar
2 | docker load -i gateway-service.tar
3 | docker load -i crapi-identity.tar
4 | docker load -i crapi-community.tar
5 | docker load -i crapi-workshop.tar
6 | docker load -i crapi-web.tar
7 | docker load -i postgres.tar
8 | docker load -i mongo.tar
9 |
--------------------------------------------------------------------------------
/deploy/docker/scripts/save.sh:
--------------------------------------------------------------------------------
1 | docker save crapi/mailhog:develop -o mailhog.tar
2 | docker save crapi/gateway-service:develop -o gateway-service.tar
3 | docker save crapi/crapi-identity:develop -o crapi-identity.tar
4 | docker save crapi/crapi-community:develop -o crapi-community.tar
5 | docker save crapi/crapi-workshop:develop -o crapi-workshop.tar
6 | docker save crapi/crapi-web:develop -o crapi-web.tar
7 | docker save postgres:14 -o postgres.tar
8 | docker save mongo:4.4 -o mongo.tar
9 |
--------------------------------------------------------------------------------
/deploy/helm/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/deploy/helm/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | name: crapi
3 | description: A Helm chart for Kubernetes
4 |
5 | # A chart can be either an 'application' or a 'library' chart.
6 | #
7 | # Application charts are a collection of templates that can be packaged into versioned archives
8 | # to be deployed.
9 | #
10 | # Library charts provide useful utilities or functions for the chart developer. They're included as
11 | # a dependency of application charts to inject those utilities and functions into the rendering
12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13 | type: application
14 |
15 | # This is the chart version. This version number should be incremented each time you make changes
16 | # to the chart and its templates, including the app version.
17 | # Versions are expected to follow Semantic Versioning (https://semver.org/)
18 | version: 0.1.4
19 |
20 | # This is the version number of the application being deployed. This version number should be
21 | # incremented each time you make changes to the application. Versions are not expected to
22 | # follow Semantic Versioning. They should reflect the version the application is using.
23 | appVersion: develop
24 |
--------------------------------------------------------------------------------
/deploy/helm/templates/api-gateway-service/config.yaml:
--------------------------------------------------------------------------------
1 | {{ if .Values.apiGatewayServiceInstall }}
2 | apiVersion: v1
3 | kind: ConfigMap
4 | metadata:
5 | name: {{ .Values.apiGatewayService.config.name }}
6 | labels:
7 | release: {{ .Release.Name }}
8 | {{- toYaml .Values.apiGatewayService.config.labels | nindent 4 }}
9 | data:
10 | SERVER_PORT: {{ .Values.apiGatewayService.port | quote }}
11 | {{ end }}
--------------------------------------------------------------------------------
/deploy/helm/templates/api-gateway-service/service.yaml:
--------------------------------------------------------------------------------
1 | {{ if .Values.apiGatewayServiceInstall }}
2 | apiVersion: v1
3 | kind: Service
4 | metadata:
5 | name: {{ .Values.apiGatewayService.service.name }}
6 | labels:
7 | release: {{ .Release.Name }}
8 | {{- with .Values.apiGatewayService.service.labels }}
9 | {{- toYaml . | nindent 4 }}
10 | {{- end }}
11 | spec:
12 | ports:
13 | - port: {{ .Values.apiGatewayService.port }}
14 | name: https
15 | selector:
16 | {{- toYaml .Values.apiGatewayService.serviceSelectorLabels | nindent 4 }}
17 | {{ end }}
--------------------------------------------------------------------------------
/deploy/helm/templates/community/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.community.service.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- with .Values.community.service.labels }}
8 | {{- toYaml . | nindent 4 }}
9 | {{- end }}
10 | spec:
11 | ports:
12 | - port: {{ .Values.community.port }}
13 | name: go
14 | selector:
15 | {{- toYaml .Values.community.serviceSelectorLabels | nindent 4 }}
16 |
--------------------------------------------------------------------------------
/deploy/helm/templates/identity/jwt-key-secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: {{ .Values.identity.jwtKeySecret.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- with .Values.identity.config.labels }}
8 | {{- toYaml . | nindent 4 }}
9 | {{- end }}
10 | type: Opaque
11 | data:
12 | {{ (.Files.Glob .Values.identity.jwtKeySecret.file).AsSecrets | indent 2 }}
13 |
--------------------------------------------------------------------------------
/deploy/helm/templates/identity/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.identity.service.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- toYaml .Values.identity.service.labels | nindent 4}}
8 | spec:
9 | ports:
10 | - port: {{ .Values.identity.port }}
11 | name: java
12 | selector:
13 | {{- toYaml .Values.identity.serviceSelectorLabels | nindent 4 }}
14 |
--------------------------------------------------------------------------------
/deploy/helm/templates/mailhog/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: {{ .Values.mailhog.config.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- toYaml .Values.mailhog.config.labels | nindent 4 }}
8 | data:
9 | MH_MONGO_URI: {{ .Values.mongodb.config.mongoUri }}
10 | MH_STORAGE: {{ .Values.mailhog.config.mailhogStorage }}
11 |
--------------------------------------------------------------------------------
/deploy/helm/templates/mailhog/ingress.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.mailhog.webService.name }}-ingress
5 | namespace: {{ .Values.mailhog.namespace }}
6 | labels:
7 | release: {{ .Release.Name }}
8 | {{- with .Values.mailhog.webService.labels }}
9 | {{- toYaml . | nindent 4 }}
10 | {{- end }}
11 | spec:
12 | ports:
13 | - name: web
14 | port: {{ .Values.mailhog.webPort }}
15 | nodePort: {{ .Values.mailhog.webService.nodePort }}
16 | protocol: TCP
17 | selector:
18 | {{- toYaml .Values.mailhog.serviceSelectorLabels | nindent 4 }}
19 | sessionAffinity: None
20 | type: LoadBalancer
21 |
--------------------------------------------------------------------------------
/deploy/helm/templates/mailhog/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.mailhog.smtpService.name }}
5 | namespace: {{ .Values.mailhog.namespace }}
6 | labels:
7 | release: {{ .Release.Name }}
8 | {{- with .Values.mailhog.smtpService.labels }}
9 | {{- toYaml . | nindent 4 }}
10 | {{- end }}
11 | spec:
12 | ports:
13 | - name: smtp
14 | port: {{ .Values.mailhog.smtpPort }}
15 | protocol: TCP
16 | selector:
17 | {{- toYaml .Values.mailhog.serviceSelectorLabels | nindent 4 }}
18 | sessionAffinity: None
19 | type: ClusterIP
20 |
--------------------------------------------------------------------------------
/deploy/helm/templates/mailhog/webservice.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.mailhog.webService.name }}
5 | namespace: {{ .Values.mailhog.namespace }}
6 | labels:
7 | release: {{ .Release.Name }}
8 | {{- with .Values.mailhog.webService.labels }}
9 | {{- toYaml . | nindent 4 }}
10 | {{- end }}
11 | spec:
12 | ports:
13 | - name: smtp
14 | port: {{ .Values.mailhog.webPort }}
15 | protocol: TCP
16 | selector:
17 | {{- toYaml .Values.mailhog.serviceSelectorLabels | nindent 4 }}
18 | sessionAffinity: None
19 | type: ClusterIP
20 |
--------------------------------------------------------------------------------
/deploy/helm/templates/mongodb/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: {{ .Values.mongodb.config.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- with .Values.mongodb.config.labels }}
8 | {{- toYaml . | nindent 4 }}
9 | {{- end }}
10 | data:
11 | MONGO_INITDB_ROOT_USERNAME: {{ .Values.mongodb.config.mongoUser }}
12 | MONGO_INITDB_ROOT_PASSWORD: {{ .Values.mongodb.config.mongoPassword }}
13 |
--------------------------------------------------------------------------------
/deploy/helm/templates/mongodb/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.mongodb.service.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- with .Values.mongodb.service.labels }}
8 | {{- toYaml . | nindent 4 }}
9 | {{- end }}
10 | spec:
11 | ports:
12 | - port: {{ .Values.mongodb.port }}
13 | name: mongo
14 | selector:
15 | {{- toYaml .Values.mongodb.serviceSelectorLabels | nindent 4 }}
16 |
--------------------------------------------------------------------------------
/deploy/helm/templates/mongodb/storage.yaml:
--------------------------------------------------------------------------------
1 | {{- if eq .Values.mongodb.storage.type "manual" }}
2 | apiVersion: v1
3 | kind: PersistentVolume
4 | metadata:
5 | name: {{ .Values.mongodb.storage.pv.name }}
6 | labels:
7 | release: {{ .Release.Name }}
8 | {{- toYaml .Values.mongodb.storage.pv.labels | nindent 4 }}
9 | spec:
10 | storageClassName: {{ .Values.mongodb.storage.type }}
11 | capacity:
12 | storage: {{ .Values.mongodb.storage.pv.resources.storage }}
13 | accessModes:
14 | - ReadWriteOnce
15 | hostPath:
16 | path: {{ .Values.mongodb.storage.pv.hostPath }}
17 | ---
18 | {{- end }}
19 | apiVersion: v1
20 | kind: PersistentVolumeClaim
21 | metadata:
22 | name: {{ .Values.mongodb.storage.pvc.name }}
23 | labels:
24 | release: {{ .Release.Name }}
25 | {{- toYaml .Values.mongodb.storage.pvc.labels | nindent 4 }}
26 | spec:
27 | {{- if ne .Values.mongodb.storage.type "default" }}
28 | storageClassName: {{ .Values.mongodb.storage.type }}
29 | {{- end }}
30 | accessModes:
31 | - ReadWriteOnce
32 | resources:
33 | {{- toYaml .Values.mongodb.storage.pvc.resources | nindent 4 }}
34 |
35 |
--------------------------------------------------------------------------------
/deploy/helm/templates/postgres/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: {{ .Values.postgresdb.config.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- with .Values.postgresdb.config.labels }}
8 | {{- toYaml . | nindent 4 }}
9 | {{- end }}
10 | data:
11 | POSTGRES_USER: {{ .Values.postgresdb.config.postgresUser }}
12 | POSTGRES_PASSWORD: {{ .Values.postgresdb.config.postgresPassword }}
13 | POSTGRES_DB: {{ .Values.postgresdb.config.postgresDbName }}
14 |
--------------------------------------------------------------------------------
/deploy/helm/templates/postgres/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.postgresdb.service.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- with .Values.postgresdb.service.labels }}
8 | {{- toYaml . | nindent 4 }}
9 | {{- end }}
10 | spec:
11 | ports:
12 | - port: {{ .Values.postgresdb.port }}
13 | name: postgres
14 | selector:
15 | {{- toYaml .Values.postgresdb.serviceSelectorLabels | nindent 4 }}
16 |
--------------------------------------------------------------------------------
/deploy/helm/templates/postgres/storage.yaml:
--------------------------------------------------------------------------------
1 | {{- if eq .Values.postgresdb.storage.type "manual" }}
2 | apiVersion: v1
3 | kind: PersistentVolume
4 | metadata:
5 | name: {{ .Values.postgresdb.storage.pv.name }}
6 | labels:
7 | release: {{ .Release.Name }}
8 | {{- toYaml .Values.postgresdb.storage.pv.labels | nindent 4 }}
9 | spec:
10 | storageClassName: {{ .Values.postgresdb.storage.type }}
11 | capacity:
12 | storage: {{ .Values.postgresdb.storage.pv.resources.storage }}
13 | accessModes:
14 | - ReadWriteOnce
15 | hostPath:
16 | path: {{ .Values.postgresdb.storage.pv.hostPath }}
17 | ---
18 | {{- end }}
19 | apiVersion: v1
20 | kind: PersistentVolumeClaim
21 | metadata:
22 | name: {{ .Values.postgresdb.storage.pvc.name }}
23 | labels:
24 | release: {{ .Release.Name }}
25 | {{- toYaml .Values.postgresdb.storage.pvc.labels | nindent 4 }}
26 | spec:
27 | {{- if ne .Values.postgresdb.storage.type "default" }}
28 | storageClassName: {{ .Values.postgresdb.storage.type }}
29 | {{- end }}
30 | accessModes:
31 | - ReadWriteOnce
32 | resources:
33 | {{- toYaml .Values.postgresdb.storage.pvc.resources | nindent 4 }}
34 |
--------------------------------------------------------------------------------
/deploy/helm/templates/rbac/role.yaml:
--------------------------------------------------------------------------------
1 | kind: ClusterRole
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | metadata:
4 | namespace: crapi
5 | name: waitfor-reader
6 | rules:
7 | - apiGroups: [""]
8 | resources: ["services","pods"]
9 | verbs: ["get", "watch", "list"]
10 |
--------------------------------------------------------------------------------
/deploy/helm/templates/rbac/rolebinding.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: rbac.authorization.k8s.io/v1
2 | kind: ClusterRoleBinding
3 | metadata:
4 | namespace: crapi
5 | name: waitfor-grant
6 | subjects:
7 | - kind: ServiceAccount
8 | name: default
9 | namespace: crapi
10 | apiGroup: ""
11 | roleRef:
12 | kind: ClusterRole
13 | name: waitfor-reader
14 | apiGroup: ""
15 |
--------------------------------------------------------------------------------
/deploy/helm/templates/web/configmap.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: {{ .Values.web.config.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- toYaml .Values.web.config.labels | nindent 4 }}
8 | data:
9 | COMMUNITY_SERVICE: {{ .Values.community.service.name }}:{{ .Values.community.port }}
10 | IDENTITY_SERVICE: {{ .Values.identity.service.name }}:{{ .Values.identity.port }}
11 | WORKSHOP_SERVICE: {{ .Values.workshop.service.name }}:{{ .Values.workshop.port }}
12 | MAILHOG_WEB_SERVICE: {{ .Values.mailhog.webService.name }}:{{ .Values.mailhog.webPort }}
13 | TLS_ENABLED: {{ .Values.tlsEnabled | quote }}
14 |
--------------------------------------------------------------------------------
/deploy/helm/templates/web/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: {{ .Values.web.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- toYaml .Values.web.deploymentLabels | nindent 4 }}
8 | spec:
9 | replicas: {{ .Values.web.replicaCount }}
10 | selector:
11 | matchLabels:
12 | {{- with .Values.web.deploymentSelectorMatchLabels }}
13 | {{- toYaml . | nindent 6 }}
14 | {{- end }}
15 | template:
16 | metadata:
17 | labels:
18 | release: {{ .Release.Name }}
19 | {{- toYaml .Values.web.podLabels | nindent 8 }}
20 | spec:
21 | containers:
22 | - name: {{ .Values.web.name }}
23 | image: {{ .Values.web.image }}:{{ .Chart.AppVersion }}
24 | imagePullPolicy: {{ .Values.imagePullPolicy }}
25 | ports:
26 | - containerPort: 443
27 | - containerPort: 80
28 | {{- if .Values.web.resources }}
29 | resources:
30 | {{- toYaml .Values.web.resources | nindent 12 }}
31 | {{- end }}
32 | envFrom:
33 | - configMapRef:
34 | name: {{ .Values.web.config.name }}
35 |
--------------------------------------------------------------------------------
/deploy/helm/templates/web/ingress.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.web.service.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- toYaml .Values.web.service.labels | nindent 4 }}
8 | spec:
9 | ports:
10 | - port: {{ .Values.web.port }}
11 | targetPort: 80
12 | nodePort: {{ .Values.web.service.nodePort }}
13 | name: nginx
14 | - port: {{ .Values.web.sslPort }}
15 | targetPort: 443
16 | nodePort: {{ .Values.web.service.sslNodePort }}
17 | name: nginx-ssl
18 | type: LoadBalancer
19 | selector:
20 | {{- toYaml .Values.web.serviceSelectorLabels | nindent 4 }}
21 |
--------------------------------------------------------------------------------
/deploy/helm/templates/workshop/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.workshop.service.name }}
5 | labels:
6 | release: {{ .Release.Name }}
7 | {{- with .Values.workshop.service.labels }}
8 | {{- toYaml . | nindent 4 }}
9 | {{- end }}
10 | spec:
11 | ports:
12 | - port: {{ .Values.workshop.port }}
13 | name: python
14 | selector:
15 | {{- toYaml .Values.workshop.serviceSelectorLabels | nindent 4 }}
16 |
--------------------------------------------------------------------------------
/deploy/helm/values-pv.yaml:
--------------------------------------------------------------------------------
1 | mongodb:
2 | storage:
3 | type: "manual"
4 | pv:
5 | name: mongodb-pv
6 | labels:
7 | app: mongodb
8 | resources:
9 | storage: 2Gi
10 | hostPath: /mnt/mongodb
11 | accessModes: ReadWriteOnce
12 | pvc:
13 | name: mongodb-pv-claim
14 | labels:
15 | app: mongodb
16 | resources:
17 | requests:
18 | storage: 2Gi
19 |
20 | postgresdb:
21 | storage:
22 | type: "manual"
23 | pv:
24 | name: postgres-pv
25 | labels:
26 | app: postgresdb
27 | resources:
28 | storage: 2Gi
29 | hostPath: /mnt/postgresdb
30 | pvc:
31 | name: postgres-pv-claim
32 | labels:
33 | app: postgresdb
34 | accessModes: ReadWriteOnce
35 | resources:
36 | requests:
37 | storage: 2Gi
38 |
--------------------------------------------------------------------------------
/deploy/helm/values-safe.yaml:
--------------------------------------------------------------------------------
1 | # Default values for crapi.
2 | # This is a YAML-formatted file.
3 | # Declare variables to be passed into your templates.
4 | replicaCount: 1
5 | imagePullPolicy: Always
6 |
7 | enableLog4j: false
8 | enableShellInjection: false
9 |
10 | web:
11 | image: crapi/crapi-web
12 | port: 80
13 | identity:
14 | image: crapi/crapi-identity
15 | port: 8080
16 | community:
17 | image: crapi/crapi-community
18 | port: 8087
19 | workshop:
20 | image: crapi/crapi-workshop
21 | port: 8000
22 | mailhog:
23 | image: crapi/mailhog
24 | webPort: 8025
25 | mongodb:
26 | image: mongo
27 | version: 5.0
28 | postgresdb:
29 | image: postgres
30 | version: 14
31 |
--------------------------------------------------------------------------------
/deploy/helm/values-tls.yaml:
--------------------------------------------------------------------------------
1 | # Default values for crapi.
2 | # This is a YAML-formatted file.
3 | # Declare variables to be passed into your templates.
4 | replicaCount: 1
5 | imagePullPolicy: Always
6 | apiGatewayServiceUrl: https://api.mypremiumdealership.com
7 | apiGatewayServiceInstall: false
8 | enableLog4j: true
9 | enableShellInjection: true
10 | tlsEnabled: true
11 |
12 | web:
13 | image: crapi/crapi-web
14 | port: 80
15 | sslPort: 443
16 | identity:
17 | image: crapi/crapi-identity
18 | port: 8080
19 | community:
20 | image: crapi/crapi-community
21 | port: 8087
22 | workshop:
23 | image: crapi/crapi-workshop
24 | port: 8000
25 | mailhog:
26 | image: crapi/mailhog
27 | mongodb:
28 | image: mongo
29 | version: 5.0
30 | postgresdb:
31 | image: postgres
32 | version: 14
33 |
--------------------------------------------------------------------------------
/deploy/k8s/base/community/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: crapi-community-configmap
5 | labels:
6 | app: crapi-community
7 | data:
8 | IDENTITY_SERVICE: crapi-identity:8080
9 | DB_HOST: postgresdb
10 | DB_DRIVER: postgres
11 | DB_USER: admin
12 | DB_PASSWORD: crapisecretpassword
13 | DB_NAME: crapi
14 | DB_PORT: "5432"
15 | MONGO_DB_HOST: mongodb
16 | MONGO_DB_DRIVER: mongodb
17 | MONGO_DB_PORT: "27017"
18 | MONGO_DB_USER: admin
19 | MONGO_DB_PASSWORD: crapisecretpassword
20 | MONGO_DB_NAME: crapi
21 | SERVER_PORT: "8087"
22 |
--------------------------------------------------------------------------------
/deploy/k8s/base/community/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: crapi-community
5 | labels:
6 | app: crapi-community
7 | spec:
8 | ports:
9 | - port: 8087
10 | name: go
11 | selector:
12 | app: crapi-community
13 |
--------------------------------------------------------------------------------
/deploy/k8s/base/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd "$(dirname $0)"
3 | kubectl create namespace crapi
4 | #kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
5 |
6 | kubectl create -n secret generic jwt-key-secret --from-file=../keys
7 | kubectl apply -n crapi -f ./rbac
8 | kubectl apply -n crapi -f ./mongodb
9 | kubectl apply -n crapi -f ./postgres
10 | kubectl apply -n crapi -f ./mailhog
11 | kubectl apply -n crapi -f ./identity
12 | kubectl apply -n crapi -f ./community
13 | kubectl apply -n crapi -f ./workshop
14 | kubectl apply -n crapi -f ./web
15 |
--------------------------------------------------------------------------------
/deploy/k8s/base/gateway-service/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: gateway-service-configmap
5 | labels:
6 | app: gateway-service
7 | data:
8 | SERVER_PORT: "443"
9 |
--------------------------------------------------------------------------------
/deploy/k8s/base/gateway-service/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: gateway-service
5 | spec:
6 | replicas: 1
7 | selector:
8 | matchLabels:
9 | app: gateway-service
10 | template:
11 | metadata:
12 | labels:
13 | app: gateway-service
14 | spec:
15 | containers:
16 | - name: gateway-service
17 | image: crapi/gateway-service:latest
18 | imagePullPolicy: Always
19 | ports:
20 | - containerPort: 8087
21 | resources:
22 | limits:
23 | cpu: "100m"
24 | requests:
25 | cpu: 50m
26 |
--------------------------------------------------------------------------------
/deploy/k8s/base/gateway-service/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: gateway-service
5 | labels:
6 | app: gateway-service
7 | spec:
8 | ports:
9 | - port: 8087
10 | name: go
11 | selector:
12 | app: gateway-service
13 |
--------------------------------------------------------------------------------
/deploy/k8s/base/identity/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: crapi-identity-configmap
5 | labels:
6 | app: crapi-identity
7 | data:
8 | DB_HOST: postgresdb
9 | DB_DRIVER: postgresql
10 | JWT_SECRET: crapi #Used for creating a JWT. Can be anything
11 | DB_USER: admin
12 | DB_PASSWORD: crapisecretpassword
13 | DB_NAME: crapi
14 | DB_PORT: "5432"
15 | APP_NAME: "crapi-identity"
16 | ENABLE_SHELL_INJECTION: "false"
17 | ENABLE_LOG4J: "true"
18 | MAILHOG_HOST: mailhog
19 | MAILHOG_PORT: "1025"
20 | MAILHOG_DOMAIN: "example.com"
21 | SMTP_HOST: "smtp.example.com"
22 | SMTP_PORT: "587"
23 | SMTP_EMAIL: "user@example.com"
24 | SMTP_PASS: "xxxxxxxxxxxxxx"
25 | SMTP_FROM: "no-reply@example.com"
26 | SMTP_AUTH: "true"
27 | JWT_EXPIRATION: "604800000"
28 | SMTP_STARTTLS: "true"
29 | SERVER_PORT: "8080"
30 |
--------------------------------------------------------------------------------
/deploy/k8s/base/identity/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: crapi-identity
5 | labels:
6 | app: crapi-identity
7 | spec:
8 | ports:
9 | - port: 8080
10 | name: java
11 | selector:
12 | app: crapi-identity
13 |
--------------------------------------------------------------------------------
/deploy/k8s/base/mailhog/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: mailhog-configmap
5 | labels:
6 | app: mailhog
7 | data:
8 | MH_MONGO_URI: admin:crapisecretpassword@mongodb:27017
9 | MH_STORAGE: mongodb
--------------------------------------------------------------------------------
/deploy/k8s/base/mailhog/ingress.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: mailhog-web
5 | namespace: crapi
6 | spec:
7 | ports:
8 | - name: web
9 | port: 8025
10 | nodePort: 30025
11 | protocol: TCP
12 | selector:
13 | app: mailhog
14 | sessionAffinity: None
15 | type: LoadBalancer
--------------------------------------------------------------------------------
/deploy/k8s/base/mailhog/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: mailhog
5 | namespace: crapi
6 | spec:
7 | ports:
8 | - name: smtp
9 | port: 1025
10 | protocol: TCP
11 | targetPort: 1025
12 | selector:
13 | app: mailhog
14 | sessionAffinity: None
15 | type: ClusterIP
16 |
--------------------------------------------------------------------------------
/deploy/k8s/base/mongodb/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: mongodb-config
5 | labels:
6 | app: mongodb
7 | data:
8 | MONGO_INITDB_ROOT_USERNAME: admin
9 | MONGO_INITDB_ROOT_PASSWORD: crapisecretpassword
10 |
11 |
--------------------------------------------------------------------------------
/deploy/k8s/base/mongodb/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: mongodb
5 | labels:
6 | app: mongodb
7 | spec:
8 | ports:
9 | - port: 27017
10 | name: mongo
11 | selector:
12 | app: mongodb
13 |
--------------------------------------------------------------------------------
/deploy/k8s/base/mongodb/statefulset.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: StatefulSet
3 | metadata:
4 | name: mongodb
5 | spec:
6 | serviceName: mongodb
7 | replicas: 1
8 | selector:
9 | matchLabels:
10 | app: mongodb
11 | template:
12 | metadata:
13 | labels:
14 | app: mongodb
15 | spec:
16 | containers:
17 | - name: mongodb
18 | image: mongo:4.4
19 | imagePullPolicy: "IfNotPresent"
20 | envFrom:
21 | - configMapRef:
22 | name: mongodb-config
23 | volumeMounts:
24 | - mountPath: /data/db
25 | name: mongodb-data
26 | volumes:
27 | - name: mongodb-data
28 | persistentVolumeClaim:
29 | claimName: mongodb-pv-claim
30 |
--------------------------------------------------------------------------------
/deploy/k8s/base/mongodb/storage.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: mongodb-pv-claim
5 | labels:
6 | app: mongo
7 | spec:
8 | #storageClassName: local-path
9 | accessModes:
10 | - ReadWriteOnce
11 | resources:
12 | requests:
13 | storage: 1000Mi
14 |
--------------------------------------------------------------------------------
/deploy/k8s/base/postgres/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: postgres-config
5 | labels:
6 | app: postgresdb
7 | data:
8 | POSTGRES_USER: admin
9 | POSTGRES_PASSWORD: crapisecretpassword
10 | POSTGRES_DB: crapi
11 |
12 |
--------------------------------------------------------------------------------
/deploy/k8s/base/postgres/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: postgresdb
5 | labels:
6 | app: postgresdb
7 | spec:
8 | ports:
9 | - port: 5432
10 | name: postgres
11 | selector:
12 | app: postgresdb
13 |
--------------------------------------------------------------------------------
/deploy/k8s/base/postgres/statefulset.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: StatefulSet
3 | metadata:
4 | name: postgresdb
5 | spec:
6 | serviceName: postgresdb
7 | replicas: 1
8 | selector:
9 | matchLabels:
10 | app: postgresdb
11 | template:
12 | metadata:
13 | labels:
14 | app: postgresdb
15 | spec:
16 | containers:
17 | - name: postgres
18 | image: postgres:14
19 | args: ["-c", "max_connections=500"]
20 | imagePullPolicy: "IfNotPresent"
21 | ports:
22 | - containerPort: 5432
23 | envFrom:
24 | - configMapRef:
25 | name: postgres-config
26 |
27 | volumeMounts:
28 | - mountPath: /var/lib/postgresql/data
29 | name: postgres-data
30 | subPath: postgres
31 | volumes:
32 | - name: postgres-data
33 | persistentVolumeClaim:
34 | claimName: postgres-pv-claim
35 |
--------------------------------------------------------------------------------
/deploy/k8s/base/postgres/storage.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 |
4 | metadata:
5 | name: postgres-pv-claim
6 | labels:
7 | app: postgresdb
8 |
9 | spec:
10 | #storageClassName: local-path
11 | accessModes:
12 | - ReadWriteOnce
13 |
14 | resources:
15 | requests:
16 | storage: 1000Mi
17 |
--------------------------------------------------------------------------------
/deploy/k8s/base/rbac/role.yaml:
--------------------------------------------------------------------------------
1 | kind: ClusterRole
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | metadata:
4 | namespace: crapi
5 | name: waitfor-reader
6 | rules:
7 | - apiGroups: [""]
8 | resources: ["services","pods"]
9 | verbs: ["get", "watch", "list"]
10 |
--------------------------------------------------------------------------------
/deploy/k8s/base/rbac/rolebinding.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: rbac.authorization.k8s.io/v1
2 | kind: ClusterRoleBinding
3 | metadata:
4 | namespace: crapi
5 | name: waitfor-grant
6 | subjects:
7 | - kind: ServiceAccount
8 | name: default
9 | namespace: crapi
10 | apiGroup: ""
11 | roleRef:
12 | kind: ClusterRole
13 | name: waitfor-reader
14 | apiGroup: ""
15 |
--------------------------------------------------------------------------------
/deploy/k8s/base/web/configmap.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: crapi-web-configmap
5 | labels:
6 | app: crapi-web
7 | data:
8 | COMMUNITY_SERVICE: crapi-community:8087
9 | IDENTITY_SERVICE: crapi-identity:8080
10 | WORKSHOP_SERVICE: crapi-workshop:8000
11 |
--------------------------------------------------------------------------------
/deploy/k8s/base/web/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: crapi-web
5 | spec:
6 | replicas: 1
7 | selector:
8 | matchLabels:
9 | app: crapi-web
10 | template:
11 | metadata:
12 | labels:
13 | app: crapi-web
14 | spec:
15 | containers:
16 | - name: crapi-web
17 | image: crapi/crapi-web:latest
18 | imagePullPolicy: Always
19 | ports:
20 | - containerPort: 80
21 | resources:
22 | limits:
23 | cpu: "500m"
24 | requests:
25 | cpu: 256m
26 | envFrom:
27 | - configMapRef:
28 | name: crapi-web-configmap
--------------------------------------------------------------------------------
/deploy/k8s/base/web/ingress.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: crapi-web
5 | labels:
6 | app: crapi-web
7 | spec:
8 | ports:
9 | - port: 80
10 | nodePort: 30080
11 | name: nginx
12 | type: LoadBalancer
13 | selector:
14 | app: crapi-web
15 |
--------------------------------------------------------------------------------
/deploy/k8s/base/workshop/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: crapi-workshop-configmap
5 | labels:
6 | app: crapi-workshop
7 | data:
8 | IDENTITY_SERVICE: crapi-identity:8080
9 | SECRET_KEY: crapi
10 | DB_HOST: postgresdb
11 | DB_DRIVER: postgres
12 | DB_USER: admin
13 | DB_PASSWORD: crapisecretpassword
14 | DB_NAME: crapi
15 | DB_PORT: "5432"
16 | MONGO_DB_HOST: mongodb
17 | MONGO_DB_DRIVER: mongodb
18 | MONGO_DB_PORT: "27017"
19 | MONGO_DB_USER: admin
20 | MONGO_DB_PASSWORD: crapisecretpassword
21 | MONGO_DB_NAME: crapi
22 | SERVER_PORT: "8000"
23 |
--------------------------------------------------------------------------------
/deploy/k8s/base/workshop/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: crapi-workshop
5 | labels:
6 | app: crapi-workshop
7 | spec:
8 | ports:
9 | - port: 8000
10 | name: python
11 | selector:
12 | app: crapi-workshop
13 |
--------------------------------------------------------------------------------
/deploy/k8s/minikube/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Licensed under the Apache License, Version 2.0 (the “License”);
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an “AS IS” BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | cd "$(dirname $0)"
17 | kubectl create namespace crapi
18 |
19 | kubectl create -n crapi secret generic jwt-key-secret --from-file=../keys
20 | kubectl apply -n crapi -f ../base/rbac
21 | kubectl apply -n crapi -f ../base/mongodb
22 | kubectl apply -n crapi -f ../base/postgres
23 | kubectl apply -n crapi -f ../base/mailhog
24 | kubectl apply -n crapi -f ../base/identity
25 | kubectl apply -n crapi -f ../base/community
26 | kubectl apply -n crapi -f ../base/workshop
27 | kubectl apply -n crapi -f ../base/web
28 | kubectl apply -n crapi -f ./mailhog
29 | kubectl apply -n crapi -f ./web
30 |
--------------------------------------------------------------------------------
/deploy/k8s/minikube/mailhog/ingress.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: mailhog-web
5 | namespace: crapi
6 | spec:
7 | ports:
8 | - name: web
9 | port: 8025
10 | nodePort: 30025
11 | protocol: TCP
12 | selector:
13 | app: mailhog
14 | sessionAffinity: None
15 | type: NodePort
--------------------------------------------------------------------------------
/deploy/k8s/minikube/web/ingress.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: crapi-web
5 | labels:
6 | app: crapi-web
7 | spec:
8 | ports:
9 | - port: 80
10 | nodePort: 30080
11 | name: nginx
12 | type: NodePort
13 | selector:
14 | app: crapi-web
15 |
--------------------------------------------------------------------------------
/deploy/vagrant/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | Vagrant.configure("2") do |config|
5 |
6 | config.vm.provider "virtualbox" do |v|
7 | v.name = "crAPI"
8 | v.memory = 2048
9 | v.cpus = 1
10 | end
11 |
12 | config.vm.box = "ubuntu/jammy64"
13 | config.vm.hostname = "crapi"
14 | config.vm.network "private_network", ip: "192.168.33.20"
15 | config.vm.synced_folder "../../", "/tmp/crapi"
16 |
17 | config.vm.provision :shell do |shell|
18 | shell.privileged = true
19 | shell.path = "provisioner.sh"
20 | end
21 |
22 | end
23 |
--------------------------------------------------------------------------------
/deploy/vagrant/crapi.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=crAPI
3 | After=docker.service
4 | Requires=docker.service
5 |
6 | [Service]
7 | Type=oneshot
8 | RemainAfterExit=true
9 | WorkingDirectory=/opt/crapi
10 | ExecStart=/bin/bash -c "/usr/local/bin/docker-compose up -d --remove-orphans"
11 | ExecStop=/bin/bash -c "/usr/local/bin/docker-compose down –volumes"
12 |
13 | [Install]
14 | WantedBy=multi-user.target
15 |
--------------------------------------------------------------------------------
/docs/images/crapi-architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/docs/images/crapi-architecture.png
--------------------------------------------------------------------------------
/docs/images/monolith-pic-crapi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/docs/images/monolith-pic-crapi.png
--------------------------------------------------------------------------------
/postman_collections/car.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/postman_collections/car.mp4
--------------------------------------------------------------------------------
/postman_collections/crAPI.postman_environment.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "d72c78a4-a99a-4413-88f6-0a3bb4cdbc1c",
3 | "name": "Crapi",
4 | "values": [{
5 | "key": "url",
6 | "value": "http://127.0.0.1:30080",
7 | "enabled": true
8 | },
9 | {
10 | "key": "url_mail",
11 | "value": "http://127.0.0.1:30080/mailhog",
12 | "enabled": true
13 | }
14 | ],
15 | "_postman_variable_scope": "environment",
16 | "_postman_exported_at": "2022-05-07T14:12:58.459Z",
17 | "_postman_exported_using": "Postman/9.17.2"
18 | }
19 |
--------------------------------------------------------------------------------
/services/community/api/controllers/home_controller.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package controllers
16 |
17 | import (
18 | "net/http"
19 |
20 | "crapi.proj/goservice/api/config"
21 | "crapi.proj/goservice/api/responses"
22 | )
23 |
24 | type Server config.Server
25 |
26 | //Home API is for testing without token
27 | func (server *Server) Home(w http.ResponseWriter, r *http.Request) {
28 | responses.JSON(w, http.StatusOK, "Welcome To This crAPI API")
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/services/community/api/controllers/home_controller_test.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package controllers
16 |
17 | import (
18 | "net/http"
19 | "testing"
20 | )
21 |
22 | func TestServer_Home(t *testing.T) {
23 | type args struct {
24 | w http.ResponseWriter
25 | r *http.Request
26 | }
27 | tests := []struct {
28 | name string
29 | server *Server
30 | args args
31 | }{
32 | // TODO: Add test cases.
33 | }
34 | for _, tt := range tests {
35 | t.Run(tt.name, func(t *testing.T) {
36 | tt.server.Home(tt.args.w, tt.args.r)
37 | })
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/services/community/api/utils/utils.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package utils
16 |
17 | import (
18 | "os"
19 | "strings"
20 | )
21 |
22 | func IsTrue(a string) bool {
23 | a = strings.ToLower(a)
24 | true_list := []string{"true", "1"}
25 | for _, b := range true_list {
26 | if b == a {
27 | return true
28 | }
29 | }
30 | return false
31 | }
32 |
33 | func IsTLSEnabled() bool {
34 | tls_enabled, is_tls := os.LookupEnv("TLS_ENABLED")
35 | if is_tls && IsTrue(tls_enabled) {
36 | return true
37 | }
38 | return false
39 | }
40 |
--------------------------------------------------------------------------------
/services/community/build-image.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d community
3 | cmd /c docker build -t crapi/crapi-community:%VERSION% .
4 | cd /d .\..\
5 |
--------------------------------------------------------------------------------
/services/community/build-image.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Licensed under the Apache License, Version 2.0 (the “License”);
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an “AS IS” BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | set -x
17 | cd "$(dirname $0)"
18 | docker build -t crapi/crapi-community:${VERSION:-latest} .
19 | retVal=$?
20 | if [ $retVal -ne 0 ]; then
21 | echo "Error building crapi-community image"
22 | exit $retVal
23 | fi
--------------------------------------------------------------------------------
/services/community/go.mod:
--------------------------------------------------------------------------------
1 | module crapi.proj/goservice
2 |
3 | go 1.21
4 |
5 | require (
6 | github.com/badoux/checkmail v0.0.0-20200623144435-f9f80cb795fa
7 | github.com/dgrijalva/jwt-go v3.2.0+incompatible
8 | github.com/gorilla/mux v1.7.4
9 | github.com/jinzhu/gorm v1.9.14
10 | github.com/joho/godotenv v1.3.0
11 | github.com/lithammer/shortuuid v3.0.0+incompatible
12 | go.mongodb.org/mongo-driver v1.3.5
13 | golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
14 | )
15 |
16 | require (
17 | github.com/go-stack/stack v1.8.0 // indirect
18 | github.com/golang/snappy v0.0.1 // indirect
19 | github.com/google/uuid v1.1.1 // indirect
20 | github.com/jinzhu/inflection v1.0.0 // indirect
21 | github.com/klauspost/compress v1.9.5 // indirect
22 | github.com/lib/pq v1.7.0 // indirect
23 | github.com/pkg/errors v0.8.1 // indirect
24 | github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect
25 | github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc // indirect
26 | golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
27 | golang.org/x/text v0.3.3 // indirect
28 | )
29 |
--------------------------------------------------------------------------------
/services/community/health.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | SCHEME="http"
3 | if [ "$TLS_ENABLED" = "true" ] || [ "$TLS_ENABLED" = "1" ]; then
4 | SCHEME="https"
5 | fi
6 | curl -k $SCHEME://0.0.0.0:${SERVER_PORT:-8000}/community/home
7 |
--------------------------------------------------------------------------------
/services/community/main.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package main
16 |
17 | import (
18 | "crapi.proj/goservice/api"
19 | )
20 |
21 | func main() {
22 | api.Run()
23 | }
24 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/dgrijalva/jwt-go/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | script:
4 | - go vet ./...
5 | - go test -v ./...
6 |
7 | go:
8 | - 1.3
9 | - 1.4
10 | - 1.5
11 | - 1.6
12 | - 1.7
13 | - tip
14 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/dgrijalva/jwt-go/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 Dave Grijalva
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
9 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/dgrijalva/jwt-go/doc.go:
--------------------------------------------------------------------------------
1 | // Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
2 | //
3 | // See README.md for more info.
4 | package jwt
5 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/go-stack/stack/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | sudo: false
3 | go:
4 | - 1.7.x
5 | - 1.8.x
6 | - 1.9.x
7 | - 1.10.x
8 | - 1.11.x
9 | - tip
10 |
11 | before_install:
12 | - go get github.com/mattn/goveralls
13 |
14 | script:
15 | - goveralls -service=travis-ci
16 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/go-stack/stack/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Chris Hines
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/golang/snappy/AUTHORS:
--------------------------------------------------------------------------------
1 | # This is the official list of Snappy-Go authors for copyright purposes.
2 | # This file is distinct from the CONTRIBUTORS files.
3 | # See the latter for an explanation.
4 |
5 | # Names should be added to this file as
6 | # Name or Organization
7 | # The email address is not required for organizations.
8 |
9 | # Please keep the list sorted.
10 |
11 | Damian Gryski
12 | Google Inc.
13 | Jan Mercl <0xjnml@gmail.com>
14 | Rodolfo Carvalho
15 | Sebastien Binet
16 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/golang/snappy/decode_amd64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !appengine
6 | // +build gc
7 | // +build !noasm
8 |
9 | package snappy
10 |
11 | // decode has the same semantics as in decode_other.go.
12 | //
13 | //go:noescape
14 | func decode(dst, src []byte) int
15 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/golang/snappy/encode_amd64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !appengine
6 | // +build gc
7 | // +build !noasm
8 |
9 | package snappy
10 |
11 | // emitLiteral has the same semantics as in encode_other.go.
12 | //
13 | //go:noescape
14 | func emitLiteral(dst, lit []byte) int
15 |
16 | // emitCopy has the same semantics as in encode_other.go.
17 | //
18 | //go:noescape
19 | func emitCopy(dst []byte, offset, length int) int
20 |
21 | // extendMatch has the same semantics as in encode_other.go.
22 | //
23 | //go:noescape
24 | func extendMatch(src []byte, i, j int) int
25 |
26 | // encodeBlock has the same semantics as in encode_other.go.
27 | //
28 | //go:noescape
29 | func encodeBlock(dst, src []byte) (d int)
30 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/google/uuid/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - 1.4.3
5 | - 1.5.3
6 | - tip
7 |
8 | script:
9 | - go test -v ./...
10 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/google/uuid/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to contribute
2 |
3 | We definitely welcome patches and contribution to this project!
4 |
5 | ### Legal requirements
6 |
7 | In order to protect both you and ourselves, you will need to sign the
8 | [Contributor License Agreement](https://cla.developers.google.com/clas).
9 |
10 | You may have already signed it for other Google projects.
11 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/google/uuid/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | Paul Borman
2 | bmatsuo
3 | shawnps
4 | theory
5 | jboverfelt
6 | dsymonds
7 | cd1
8 | wallclockbuilder
9 | dansouza
10 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/google/uuid/README.md:
--------------------------------------------------------------------------------
1 | # uuid 
2 | The uuid package generates and inspects UUIDs based on
3 | [RFC 4122](http://tools.ietf.org/html/rfc4122)
4 | and DCE 1.1: Authentication and Security Services.
5 |
6 | This package is based on the github.com/pborman/uuid package (previously named
7 | code.google.com/p/go-uuid). It differs from these earlier packages in that
8 | a UUID is a 16 byte array rather than a byte slice. One loss due to this
9 | change is the ability to represent an invalid UUID (vs a NIL UUID).
10 |
11 | ###### Install
12 | `go get github.com/google/uuid`
13 |
14 | ###### Documentation
15 | [](http://godoc.org/github.com/google/uuid)
16 |
17 | Full `go doc` style documentation for the package can be viewed online without
18 | installing this package by using the GoDoc site here:
19 | http://godoc.org/github.com/google/uuid
20 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/google/uuid/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Google Inc. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package uuid generates and inspects UUIDs.
6 | //
7 | // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security
8 | // Services.
9 | //
10 | // A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to
11 | // maps or compared directly.
12 | package uuid
13 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/google/uuid/marshal.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 Google Inc. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package uuid
6 |
7 | import "fmt"
8 |
9 | // MarshalText implements encoding.TextMarshaler.
10 | func (uuid UUID) MarshalText() ([]byte, error) {
11 | var js [36]byte
12 | encodeHex(js[:], uuid)
13 | return js[:], nil
14 | }
15 |
16 | // UnmarshalText implements encoding.TextUnmarshaler.
17 | func (uuid *UUID) UnmarshalText(data []byte) error {
18 | id, err := ParseBytes(data)
19 | if err == nil {
20 | *uuid = id
21 | }
22 | return err
23 | }
24 |
25 | // MarshalBinary implements encoding.BinaryMarshaler.
26 | func (uuid UUID) MarshalBinary() ([]byte, error) {
27 | return uuid[:], nil
28 | }
29 |
30 | // UnmarshalBinary implements encoding.BinaryUnmarshaler.
31 | func (uuid *UUID) UnmarshalBinary(data []byte) error {
32 | if len(data) != 16 {
33 | return fmt.Errorf("invalid UUID (got %d bytes)", len(data))
34 | }
35 | copy(uuid[:], data)
36 | return nil
37 | }
38 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/google/uuid/node_js.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Google Inc. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build js
6 |
7 | package uuid
8 |
9 | // getHardwareInterface returns nil values for the JS version of the code.
10 | // This remvoves the "net" dependency, because it is not used in the browser.
11 | // Using the "net" library inflates the size of the transpiled JS code by 673k bytes.
12 | func getHardwareInterface(name string) (string, []byte) { return "", nil }
13 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/google/uuid/node_net.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Google Inc. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !js
6 |
7 | package uuid
8 |
9 | import "net"
10 |
11 | var interfaces []net.Interface // cached list of interfaces
12 |
13 | // getHardwareInterface returns the name and hardware address of interface name.
14 | // If name is "" then the name and hardware address of one of the system's
15 | // interfaces is returned. If no interfaces are found (name does not exist or
16 | // there are no interfaces) then "", nil is returned.
17 | //
18 | // Only addresses of at least 6 bytes are returned.
19 | func getHardwareInterface(name string) (string, []byte) {
20 | if interfaces == nil {
21 | var err error
22 | interfaces, err = net.Interfaces()
23 | if err != nil {
24 | return "", nil
25 | }
26 | }
27 | for _, ifs := range interfaces {
28 | if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) {
29 | return ifs.Name, ifs.HardwareAddr
30 | }
31 | }
32 | return "", nil
33 | }
34 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/gorilla/mux/AUTHORS:
--------------------------------------------------------------------------------
1 | # This is the official list of gorilla/mux authors for copyright purposes.
2 | #
3 | # Please keep the list sorted.
4 |
5 | Google LLC (https://opensource.google.com/)
6 | Kamil Kisielk
7 | Matt Silverlock
8 | Rodrigo Moraes (https://github.com/moraes)
9 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/gorilla/mux/test_helpers.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Gorilla Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package mux
6 |
7 | import "net/http"
8 |
9 | // SetURLVars sets the URL variables for the given request, to be accessed via
10 | // mux.Vars for testing route behaviour. Arguments are not modified, a shallow
11 | // copy is returned.
12 | //
13 | // This API should only be used for testing purposes; it provides a way to
14 | // inject variables into the request context. Alternatively, URL variables
15 | // can be set by making a route that captures the required variables,
16 | // starting a server and sending the request to that server.
17 | func SetURLVars(r *http.Request, val map[string]string) *http.Request {
18 | return requestWithVars(r, val)
19 | }
20 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/jinzhu/gorm/License:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013-NOW Jinzhu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/jinzhu/gorm/README.md:
--------------------------------------------------------------------------------
1 | # GORM
2 |
3 | Moved to https://github.com/go-gorm/gorm
4 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/jinzhu/gorm/callback_row_query.go:
--------------------------------------------------------------------------------
1 | package gorm
2 |
3 | import (
4 | "database/sql"
5 | "fmt"
6 | )
7 |
8 | // Define callbacks for row query
9 | func init() {
10 | DefaultCallback.RowQuery().Register("gorm:row_query", rowQueryCallback)
11 | }
12 |
13 | type RowQueryResult struct {
14 | Row *sql.Row
15 | }
16 |
17 | type RowsQueryResult struct {
18 | Rows *sql.Rows
19 | Error error
20 | }
21 |
22 | // queryCallback used to query data from database
23 | func rowQueryCallback(scope *Scope) {
24 | if result, ok := scope.InstanceGet("row_query_result"); ok {
25 | scope.prepareQuerySQL()
26 |
27 | if str, ok := scope.Get("gorm:query_hint"); ok {
28 | scope.SQL = fmt.Sprint(str) + scope.SQL
29 | }
30 |
31 | if str, ok := scope.Get("gorm:query_option"); ok {
32 | scope.SQL += addExtraSpaceIfExist(fmt.Sprint(str))
33 | }
34 |
35 | if rowResult, ok := result.(*RowQueryResult); ok {
36 | rowResult.Row = scope.SQLDB().QueryRow(scope.SQL, scope.SQLVars...)
37 | } else if rowsResult, ok := result.(*RowsQueryResult); ok {
38 | rowsResult.Rows, rowsResult.Error = scope.SQLDB().Query(scope.SQL, scope.SQLVars...)
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/jinzhu/gorm/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | mysql:
5 | image: 'mysql:latest'
6 | ports:
7 | - 9910:3306
8 | environment:
9 | - MYSQL_DATABASE=gorm
10 | - MYSQL_USER=gorm
11 | - MYSQL_PASSWORD=gorm
12 | - MYSQL_RANDOM_ROOT_PASSWORD="yes"
13 | postgres:
14 | image: 'postgres:latest'
15 | ports:
16 | - 9920:5432
17 | environment:
18 | - POSTGRES_USER=gorm
19 | - POSTGRES_DB=gorm
20 | - POSTGRES_PASSWORD=gorm
21 | mssql:
22 | image: 'mcmoe/mssqldocker:latest'
23 | ports:
24 | - 9930:1433
25 | environment:
26 | - ACCEPT_EULA=Y
27 | - SA_PASSWORD=LoremIpsum86
28 | - MSSQL_DB=gorm
29 | - MSSQL_USER=gorm
30 | - MSSQL_PASSWORD=LoremIpsum86
31 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/jinzhu/gorm/interface.go:
--------------------------------------------------------------------------------
1 | package gorm
2 |
3 | import (
4 | "context"
5 | "database/sql"
6 | )
7 |
8 | // SQLCommon is the minimal database connection functionality gorm requires. Implemented by *sql.DB.
9 | type SQLCommon interface {
10 | Exec(query string, args ...interface{}) (sql.Result, error)
11 | Prepare(query string) (*sql.Stmt, error)
12 | Query(query string, args ...interface{}) (*sql.Rows, error)
13 | QueryRow(query string, args ...interface{}) *sql.Row
14 | }
15 |
16 | type sqlDb interface {
17 | Begin() (*sql.Tx, error)
18 | BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
19 | }
20 |
21 | type sqlTx interface {
22 | Commit() error
23 | Rollback() error
24 | }
25 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/jinzhu/gorm/model.go:
--------------------------------------------------------------------------------
1 | package gorm
2 |
3 | import "time"
4 |
5 | // Model base model definition, including fields `ID`, `CreatedAt`, `UpdatedAt`, `DeletedAt`, which could be embedded in your models
6 | // type User struct {
7 | // gorm.Model
8 | // }
9 | type Model struct {
10 | ID uint `gorm:"primary_key"`
11 | CreatedAt time.Time
12 | UpdatedAt time.Time
13 | DeletedAt *time.Time `sql:"index"`
14 | }
15 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/jinzhu/gorm/test_all.sh:
--------------------------------------------------------------------------------
1 | dialects=("postgres" "mysql" "mssql" "sqlite")
2 |
3 | for dialect in "${dialects[@]}" ; do
4 | DEBUG=false GORM_DIALECT=${dialect} go test
5 | done
6 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/jinzhu/inflection/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 - Jinzhu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/jinzhu/inflection/wercker.yml:
--------------------------------------------------------------------------------
1 | box: golang
2 |
3 | build:
4 | steps:
5 | - setup-go-workspace
6 |
7 | # Gets the dependencies
8 | - script:
9 | name: go get
10 | code: |
11 | go get
12 |
13 | # Build the project
14 | - script:
15 | name: go build
16 | code: |
17 | go build ./...
18 |
19 | # Test the project
20 | - script:
21 | name: go test
22 | code: |
23 | go test ./...
24 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/joho/godotenv/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - 1.x
5 |
6 | os:
7 | - linux
8 | - osx
9 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/joho/godotenv/LICENCE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 John Barton
2 |
3 | MIT License
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 |
24 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/klauspost/compress/snappy/AUTHORS:
--------------------------------------------------------------------------------
1 | # This is the official list of Snappy-Go authors for copyright purposes.
2 | # This file is distinct from the CONTRIBUTORS files.
3 | # See the latter for an explanation.
4 |
5 | # Names should be added to this file as
6 | # Name or Organization
7 | # The email address is not required for organizations.
8 |
9 | # Please keep the list sorted.
10 |
11 | Damian Gryski
12 | Google Inc.
13 | Jan Mercl <0xjnml@gmail.com>
14 | Rodolfo Carvalho
15 | Sebastien Binet
16 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/klauspost/compress/snappy/decode_amd64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !appengine
6 | // +build gc
7 | // +build !noasm
8 |
9 | package snappy
10 |
11 | // decode has the same semantics as in decode_other.go.
12 | //
13 | //go:noescape
14 | func decode(dst, src []byte) int
15 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/klauspost/compress/snappy/encode_amd64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !appengine
6 | // +build gc
7 | // +build !noasm
8 |
9 | package snappy
10 |
11 | // emitLiteral has the same semantics as in encode_other.go.
12 | //
13 | //go:noescape
14 | func emitLiteral(dst, lit []byte) int
15 |
16 | // emitCopy has the same semantics as in encode_other.go.
17 | //
18 | //go:noescape
19 | func emitCopy(dst []byte, offset, length int) int
20 |
21 | // extendMatch has the same semantics as in encode_other.go.
22 | //
23 | //go:noescape
24 | func extendMatch(src []byte, i, j int) int
25 |
26 | // encodeBlock has the same semantics as in encode_other.go.
27 | //
28 | //go:noescape
29 | func encodeBlock(dst, src []byte) (d int)
30 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/klauspost/compress/snappy/runbench.cmd:
--------------------------------------------------------------------------------
1 | del old.txt
2 | go test -bench=. >>old.txt && go test -bench=. >>old.txt && go test -bench=. >>old.txt && benchstat -delta-test=ttest old.txt new.txt
3 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go:
--------------------------------------------------------------------------------
1 | // +build !appengine
2 | // +build gc
3 | // +build !purego
4 |
5 | package xxhash
6 |
7 | // Sum64 computes the 64-bit xxHash digest of b.
8 | //
9 | //go:noescape
10 | func Sum64(b []byte) uint64
11 |
12 | //go:noescape
13 | func writeBlocks(*Digest, []byte) int
14 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_safe.go:
--------------------------------------------------------------------------------
1 | package xxhash
2 |
3 | // Sum64String computes the 64-bit xxHash digest of s.
4 | func Sum64String(s string) uint64 {
5 | return Sum64([]byte(s))
6 | }
7 |
8 | // WriteString adds more data to d. It always returns len(s), nil.
9 | func (d *Digest) WriteString(s string) (n int, err error) {
10 | return d.Write([]byte(s))
11 | }
12 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-2013, 'pq' Contributors
2 | Portions Copyright (C) 2011 Blake Mizerany
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 |
6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/README.md:
--------------------------------------------------------------------------------
1 | # pq - A pure Go postgres driver for Go's database/sql package
2 |
3 | [](https://pkg.go.dev/github.com/lib/pq?tab=doc)
4 |
5 | ## Install
6 |
7 | go get github.com/lib/pq
8 |
9 | ## Features
10 |
11 | * SSL
12 | * Handles bad connections for `database/sql`
13 | * Scan `time.Time` correctly (i.e. `timestamp[tz]`, `time[tz]`, `date`)
14 | * Scan binary blobs correctly (i.e. `bytea`)
15 | * Package for `hstore` support
16 | * COPY FROM support
17 | * pq.ParseURL for converting urls to connection strings for sql.Open.
18 | * Many libpq compatible environment variables
19 | * Unix socket support
20 | * Notifications: `LISTEN`/`NOTIFY`
21 | * pgpass support
22 |
23 | ## Optional Features
24 |
25 | * GSS (Kerberos) auth (to use, see GoDoc)
26 |
27 | ## Tests
28 |
29 | `go test` is used for testing. See [TESTS.md](TESTS.md) for more details.
30 |
31 | ## Status
32 |
33 | This package is effectively in maintenance mode and is not actively developed. Small patches and features are only rarely reviewed and merged. We recommend using [pgx](https://github.com/jackc/pgx) which is actively maintained.
34 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/TESTS.md:
--------------------------------------------------------------------------------
1 | # Tests
2 |
3 | ## Running Tests
4 |
5 | `go test` is used for testing. A running PostgreSQL
6 | server is required, with the ability to log in. The
7 | database to connect to test with is "pqgotest," on
8 | "localhost" but these can be overridden using [environment
9 | variables](https://www.postgresql.org/docs/9.3/static/libpq-envars.html).
10 |
11 | Example:
12 |
13 | PGHOST=/run/postgresql go test
14 |
15 | ## Benchmarks
16 |
17 | A benchmark suite can be run as part of the tests:
18 |
19 | go test -bench .
20 |
21 | ## Example setup (Docker)
22 |
23 | Run a postgres container:
24 |
25 | ```
26 | docker run --expose 5432:5432 postgres
27 | ```
28 |
29 | Run tests:
30 |
31 | ```
32 | PGHOST=localhost PGPORT=5432 PGUSER=postgres PGSSLMODE=disable PGDATABASE=postgres go test
33 | ```
34 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/krb.go:
--------------------------------------------------------------------------------
1 | package pq
2 |
3 | // NewGSSFunc creates a GSS authentication provider, for use with
4 | // RegisterGSSProvider.
5 | type NewGSSFunc func() (GSS, error)
6 |
7 | var newGss NewGSSFunc
8 |
9 | // RegisterGSSProvider registers a GSS authentication provider. For example, if
10 | // you need to use Kerberos to authenticate with your server, add this to your
11 | // main package:
12 | //
13 | // import "github.com/lib/pq/auth/kerberos"
14 | //
15 | // func init() {
16 | // pq.RegisterGSSProvider(func() (pq.GSS, error) { return kerberos.NewGSS() })
17 | // }
18 | func RegisterGSSProvider(newGssArg NewGSSFunc) {
19 | newGss = newGssArg
20 | }
21 |
22 | // GSS provides GSSAPI authentication (e.g., Kerberos).
23 | type GSS interface {
24 | GetInitToken(host string, service string) ([]byte, error)
25 | GetInitTokenFromSpn(spn string) ([]byte, error)
26 | Continue(inToken []byte) (done bool, outToken []byte, err error)
27 | }
28 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/oid/doc.go:
--------------------------------------------------------------------------------
1 | // Package oid contains OID constants
2 | // as defined by the Postgres server.
3 | package oid
4 |
5 | // Oid is a Postgres Object ID.
6 | type Oid uint32
7 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/ssl_permissions.go:
--------------------------------------------------------------------------------
1 | // +build !windows
2 |
3 | package pq
4 |
5 | import "os"
6 |
7 | // sslKeyPermissions checks the permissions on user-supplied ssl key files.
8 | // The key file should have very little access.
9 | //
10 | // libpq does not check key file permissions on Windows.
11 | func sslKeyPermissions(sslkey string) error {
12 | info, err := os.Stat(sslkey)
13 | if err != nil {
14 | return err
15 | }
16 | if info.Mode().Perm()&0077 != 0 {
17 | return ErrSSLKeyHasWorldPermissions
18 | }
19 | return nil
20 | }
21 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/ssl_windows.go:
--------------------------------------------------------------------------------
1 | // +build windows
2 |
3 | package pq
4 |
5 | // sslKeyPermissions checks the permissions on user-supplied ssl key files.
6 | // The key file should have very little access.
7 | //
8 | // libpq does not check key file permissions on Windows.
9 | func sslKeyPermissions(string) error { return nil }
10 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/user_posix.go:
--------------------------------------------------------------------------------
1 | // Package pq is a pure Go Postgres driver for the database/sql package.
2 |
3 | // +build aix darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris rumprun
4 |
5 | package pq
6 |
7 | import (
8 | "os"
9 | "os/user"
10 | )
11 |
12 | func userCurrent() (string, error) {
13 | u, err := user.Current()
14 | if err == nil {
15 | return u.Username, nil
16 | }
17 |
18 | name := os.Getenv("USER")
19 | if name != "" {
20 | return name, nil
21 | }
22 |
23 | return "", ErrCouldNotDetectUsername
24 | }
25 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/user_windows.go:
--------------------------------------------------------------------------------
1 | // Package pq is a pure Go Postgres driver for the database/sql package.
2 | package pq
3 |
4 | import (
5 | "path/filepath"
6 | "syscall"
7 | )
8 |
9 | // Perform Windows user name lookup identically to libpq.
10 | //
11 | // The PostgreSQL code makes use of the legacy Win32 function
12 | // GetUserName, and that function has not been imported into stock Go.
13 | // GetUserNameEx is available though, the difference being that a
14 | // wider range of names are available. To get the output to be the
15 | // same as GetUserName, only the base (or last) component of the
16 | // result is returned.
17 | func userCurrent() (string, error) {
18 | pw_name := make([]uint16, 128)
19 | pwname_size := uint32(len(pw_name)) - 1
20 | err := syscall.GetUserNameEx(syscall.NameSamCompatible, &pw_name[0], &pwname_size)
21 | if err != nil {
22 | return "", ErrCouldNotDetectUsername
23 | }
24 | s := syscall.UTF16ToString(pw_name)
25 | u := filepath.Base(s)
26 | return u, nil
27 | }
28 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lib/pq/uuid.go:
--------------------------------------------------------------------------------
1 | package pq
2 |
3 | import (
4 | "encoding/hex"
5 | "fmt"
6 | )
7 |
8 | // decodeUUIDBinary interprets the binary format of a uuid, returning it in text format.
9 | func decodeUUIDBinary(src []byte) ([]byte, error) {
10 | if len(src) != 16 {
11 | return nil, fmt.Errorf("pq: unable to decode uuid; bad length: %d", len(src))
12 | }
13 |
14 | dst := make([]byte, 36)
15 | dst[8], dst[13], dst[18], dst[23] = '-', '-', '-', '-'
16 | hex.Encode(dst[0:], src[0:4])
17 | hex.Encode(dst[9:], src[4:6])
18 | hex.Encode(dst[14:], src[6:8])
19 | hex.Encode(dst[19:], src[8:10])
20 | hex.Encode(dst[24:], src[10:16])
21 |
22 | return dst, nil
23 | }
24 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lithammer/shortuuid/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - 1.5
5 | - 1.6
6 | - 1.7
7 | - 1.8
8 | - 1.9
9 | - 1.10
10 |
11 | script:
12 | go test -v
13 |
14 | sudo: false
15 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/lithammer/shortuuid/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Peter Renström
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/pkg/errors/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go_import_path: github.com/pkg/errors
3 | go:
4 | - 1.4.x
5 | - 1.5.x
6 | - 1.6.x
7 | - 1.7.x
8 | - 1.8.x
9 | - 1.9.x
10 | - 1.10.x
11 | - 1.11.x
12 | - tip
13 |
14 | script:
15 | - go test -v ./...
16 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/pkg/errors/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: build-{build}.{branch}
2 |
3 | clone_folder: C:\gopath\src\github.com\pkg\errors
4 | shallow_clone: true # for startup speed
5 |
6 | environment:
7 | GOPATH: C:\gopath
8 |
9 | platform:
10 | - x64
11 |
12 | # http://www.appveyor.com/docs/installed-software
13 | install:
14 | # some helpful output for debugging builds
15 | - go version
16 | - go env
17 | # pre-installed MinGW at C:\MinGW is 32bit only
18 | # but MSYS2 at C:\msys64 has mingw64
19 | - set PATH=C:\msys64\mingw64\bin;%PATH%
20 | - gcc --version
21 | - g++ --version
22 |
23 | build_script:
24 | - go install -v ./...
25 |
26 | test_script:
27 | - set PATH=C:\gopath\bin;%PATH%
28 | - go test -v ./...
29 |
30 | #artifacts:
31 | # - path: '%GOPATH%\bin\*.exe'
32 | deploy: off
33 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/xdg/scram/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | sudo: false
3 | go:
4 | - "1.7"
5 | - "1.8"
6 | - "1.9"
7 | - "1.10"
8 | - master
9 | matrix:
10 | allow_failures:
11 | - go: master
12 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/xdg/scram/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 by David A. Golden. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | // Package scram provides client and server implementations of the Salted
8 | // Challenge Response Authentication Mechanism (SCRAM) described in RFC-5802
9 | // and RFC-7677.
10 | //
11 | // Usage
12 | //
13 | // The scram package provides two variables, `SHA1` and `SHA256`, that are
14 | // used to construct Client or Server objects.
15 | //
16 | // clientSHA1, err := scram.SHA1.NewClient(username, password, authID)
17 | // clientSHA256, err := scram.SHA256.NewClient(username, password, authID)
18 | //
19 | // serverSHA1, err := scram.SHA1.NewServer(credentialLookupFcn)
20 | // serverSHA256, err := scram.SHA256.NewServer(credentialLookupFcn)
21 | //
22 | // These objects are used to construct ClientConversation or
23 | // ServerConversation objects that are used to carry out authentication.
24 | package scram
25 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/xdg/stringprep/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | sudo: false
3 | go:
4 | - "1.7"
5 | - "1.8"
6 | - "1.9"
7 | - "1.10"
8 | - master
9 | matrix:
10 | allow_failures:
11 | - go: master
12 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/xdg/stringprep/README.md:
--------------------------------------------------------------------------------
1 | [](https://godoc.org/github.com/xdg/stringprep)
2 | [](https://travis-ci.org/xdg/stringprep)
3 |
4 | # stringprep – Go implementation of RFC-3454 stringprep and RFC-4013 SASLprep
5 |
6 | ## Synopsis
7 |
8 | ```
9 | import "github.com/xdg/stringprep"
10 |
11 | prepped := stringprep.SASLprep.Prepare("TrustNô1")
12 |
13 | ```
14 |
15 | ## Description
16 |
17 | This library provides an implementation of the stringprep algorithm
18 | (RFC-3454) in Go, including all data tables.
19 |
20 | A pre-built SASLprep (RFC-4013) profile is provided as well.
21 |
22 | ## Copyright and License
23 |
24 | Copyright 2018 by David A. Golden. All rights reserved.
25 |
26 | Licensed under the Apache License, Version 2.0 (the "License"). You may
27 | obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
28 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/xdg/stringprep/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 by David A. Golden. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | // Package stringprep provides data tables and algorithms for RFC-3454,
8 | // including errata (as of 2018-02). It also provides a profile for
9 | // SASLprep as defined in RFC-4013.
10 | package stringprep
11 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/xdg/stringprep/error.go:
--------------------------------------------------------------------------------
1 | package stringprep
2 |
3 | import "fmt"
4 |
5 | // Error describes problems encountered during stringprep, including what rune
6 | // was problematic.
7 | type Error struct {
8 | Msg string
9 | Rune rune
10 | }
11 |
12 | func (e Error) Error() string {
13 | return fmt.Sprintf("%s (rune: '\\u%04x')", e.Msg, e.Rune)
14 | }
15 |
--------------------------------------------------------------------------------
/services/community/vendor/github.com/xdg/stringprep/map.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 by David A. Golden. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package stringprep
8 |
9 | // Mapping represents a stringprep mapping, from a single rune to zero or more
10 | // runes.
11 | type Mapping map[rune][]rune
12 |
13 | // Map maps a rune to a (possibly empty) rune slice via a stringprep Mapping.
14 | // The ok return value is false if the rune was not found.
15 | func (m Mapping) Map(r rune) (replacement []rune, ok bool) {
16 | rs, ok := m[r]
17 | if !ok {
18 | return nil, false
19 | }
20 | return rs, true
21 | }
22 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/proxy.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package bsoncodec
8 |
9 | // Proxy is an interface implemented by types that cannot themselves be directly encoded. Types
10 | // that implement this interface with have ProxyBSON called during the encoding process and that
11 | // value will be encoded in place for the implementer.
12 | type Proxy interface {
13 | ProxyBSON() (interface{}, error)
14 | }
15 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | // Package bsonrw contains abstractions for reading and writing
8 | // BSON and BSON like types from sources.
9 | package bsonrw // import "go.mongodb.org/mongo-driver/bson/bsonrw"
10 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/bson/registry.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package bson
8 |
9 | import "go.mongodb.org/mongo-driver/bson/bsoncodec"
10 |
11 | // DefaultRegistry is the default bsoncodec.Registry. It contains the default codecs and the
12 | // primitive codecs.
13 | var DefaultRegistry = NewRegistryBuilder().Build()
14 |
15 | // NewRegistryBuilder creates a new RegistryBuilder configured with the default encoders and
16 | // deocders from the bsoncodec.DefaultValueEncoders and bsoncodec.DefaultValueDecoders types and the
17 | // PrimitiveCodecs type in this package.
18 | func NewRegistryBuilder() *bsoncodec.RegistryBuilder {
19 | rb := bsoncodec.NewRegistryBuilder()
20 | bsoncodec.DefaultValueEncoders{}.RegisterDefaultEncoders(rb)
21 | bsoncodec.DefaultValueDecoders{}.RegisterDefaultDecoders(rb)
22 | primitiveCodecs.RegisterPrimitiveCodecs(rb)
23 | return rb
24 | }
25 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/internal/const.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package internal // import "go.mongodb.org/mongo-driver/internal"
8 |
9 | // Version is the current version of the driver.
10 | var Version = "local build"
11 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions_1_10.go:
--------------------------------------------------------------------------------
1 | // +build go1.10
2 |
3 | package options
4 |
5 | import "crypto/x509"
6 |
7 | func x509CertSubject(cert *x509.Certificate) string {
8 | return cert.Subject.String()
9 | }
10 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions_1_9.go:
--------------------------------------------------------------------------------
1 | // +build !go1.10
2 |
3 | package options
4 |
5 | import (
6 | "crypto/x509"
7 | )
8 |
9 | // We don't support version less then 1.10, but Evergreen needs to be able to compile the driver
10 | // using version 1.8.
11 | func x509CertSubject(cert *x509.Certificate) string {
12 | return ""
13 | }
14 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/mongo/util.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package mongo
8 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/version/version.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package version // import "go.mongodb.org/mongo-driver/version"
8 |
9 | // Driver is the current version of the driver.
10 | var Driver = "v1.3.5"
11 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/bsonx/registry.go:
--------------------------------------------------------------------------------
1 | package bsonx
2 |
3 | import (
4 | "go.mongodb.org/mongo-driver/bson"
5 | "go.mongodb.org/mongo-driver/bson/bsoncodec"
6 | )
7 |
8 | // DefaultRegistry is the default bsoncodec.Registry. It contains the default codecs and the
9 | // primitive codecs.
10 | var DefaultRegistry = NewRegistryBuilder().Build()
11 |
12 | // NewRegistryBuilder creates a new RegistryBuilder configured with the default encoders and
13 | // deocders from the bsoncodec.DefaultValueEncoders and bsoncodec.DefaultValueDecoders types and the
14 | // PrimitiveCodecs type in this package.
15 | func NewRegistryBuilder() *bsoncodec.RegistryBuilder {
16 | rb := bsoncodec.NewRegistryBuilder()
17 | bsoncodec.DefaultValueEncoders{}.RegisterDefaultEncoders(rb)
18 | bsoncodec.DefaultValueDecoders{}.RegisterDefaultDecoders(rb)
19 | bson.PrimitiveCodecs{}.RegisterPrimitiveCodecs(rb)
20 | primitiveCodecs.RegisterPrimitiveCodecs(rb)
21 | return rb
22 | }
23 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/cred.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package auth
8 |
9 | // Cred is a user's credential.
10 | type Cred struct {
11 | Source string
12 | Username string
13 | Password string
14 | PasswordSet bool
15 | Props map[string]string
16 | }
17 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | // Package auth is not for public use.
8 | //
9 | // The API for packages in the 'private' directory have no stability
10 | // guarantee.
11 | //
12 | // The packages within the 'private' directory would normally be put into an
13 | // 'internal' directory to prohibit their use outside the 'mongo' directory.
14 | // However, some MongoDB tools require very low-level access to the building
15 | // blocks of a driver, so we have placed them under 'private' to allow these
16 | // packages to be imported by projects that need them.
17 | //
18 | // These package APIs may be modified in backwards-incompatible ways at any
19 | // time.
20 | //
21 | // You are strongly discouraged from directly using any packages
22 | // under 'private'.
23 | package auth
24 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/gssapi_not_enabled.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | //+build !gssapi
8 |
9 | package auth
10 |
11 | // GSSAPI is the mechanism name for GSSAPI.
12 | const GSSAPI = "GSSAPI"
13 |
14 | func newGSSAPIAuthenticator(cred *Cred) (Authenticator, error) {
15 | return nil, newAuthError("GSSAPI support not enabled during build (-tags gssapi)", nil)
16 | }
17 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/gssapi_not_supported.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | //+build gssapi,!windows,!linux,!darwin
8 |
9 | package auth
10 |
11 | import (
12 | "fmt"
13 | "runtime"
14 | )
15 |
16 | // GSSAPI is the mechanism name for GSSAPI.
17 | const GSSAPI = "GSSAPI"
18 |
19 | func newGSSAPIAuthenticator(cred *Cred) (Authenticator, error) {
20 | return nil, newAuthError(fmt.Sprintf("GSSAPI is not supported on %s", runtime.GOOS), nil)
21 | }
22 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/util.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package auth
8 |
9 | import (
10 | "crypto/md5"
11 | "fmt"
12 | "io"
13 | )
14 |
15 | const defaultAuthDB = "admin"
16 |
17 | func mongoPasswordDigest(username, password string) string {
18 | h := md5.New()
19 | _, _ = io.WriteString(h, username)
20 | _, _ = io.WriteString(h, ":mongo:")
21 | _, _ = io.WriteString(h, password)
22 | return fmt.Sprintf("%x", h.Sum(nil))
23 | }
24 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/description/description.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package description // import "go.mongodb.org/mongo-driver/x/mongo/driver/description"
8 |
9 | // Unknown is an unknown server or topology kind.
10 | const Unknown = 0
11 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/description/version.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package description
8 |
9 | import "strconv"
10 |
11 | // Version represents a software version.
12 | type Version struct {
13 | Desc string
14 | Parts []uint8
15 | }
16 |
17 | // AtLeast ensures that the version is at least as large as the "other" version.
18 | func (v Version) AtLeast(other ...uint8) bool {
19 | for i := range other {
20 | if i == len(v.Parts) {
21 | return false
22 | }
23 | if v.Parts[i] < other[i] {
24 | return false
25 | }
26 | }
27 | return true
28 | }
29 |
30 | // String provides the string represtation of the Version.
31 | func (v Version) String() string {
32 | if v.Desc == "" {
33 | var s string
34 | for i, p := range v.Parts {
35 | if i != 0 {
36 | s += "."
37 | }
38 | s += strconv.Itoa(int(p))
39 | }
40 | return s
41 | }
42 |
43 | return v.Desc
44 | }
45 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/description/version_range.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package description
8 |
9 | import "fmt"
10 |
11 | // VersionRange represents a range of versions.
12 | type VersionRange struct {
13 | Min int32
14 | Max int32
15 | }
16 |
17 | // NewVersionRange creates a new VersionRange given a min and a max.
18 | func NewVersionRange(min, max int32) VersionRange {
19 | return VersionRange{Min: min, Max: max}
20 | }
21 |
22 | // Includes returns a bool indicating whether the supplied integer is included
23 | // in the range.
24 | func (vr VersionRange) Includes(v int32) bool {
25 | return v >= vr.Min && v <= vr.Max
26 | }
27 |
28 | // String implements the fmt.Stringer interface.
29 | func (vr VersionRange) String() string {
30 | return fmt.Sprintf("[%d, %d]", vr.Min, vr.Max)
31 | }
32 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/legacy.go:
--------------------------------------------------------------------------------
1 | package driver
2 |
3 | // LegacyOperationKind indicates if an operation is a legacy find, getMore, or killCursors. This is used
4 | // in Operation.Execute, which will create legacy OP_QUERY, OP_GET_MORE, or OP_KILL_CURSORS instead
5 | // of sending them as a command.
6 | type LegacyOperationKind uint
7 |
8 | // These constants represent the three different kinds of legacy operations.
9 | const (
10 | LegacyNone LegacyOperationKind = iota
11 | LegacyFind
12 | LegacyGetMore
13 | LegacyKillCursors
14 | LegacyListCollections
15 | LegacyListIndexes
16 | )
17 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/errors_not_enabled.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | // +build !cse
8 |
9 | package mongocrypt
10 |
11 | // Error represents an error from an operation on a MongoCrypt instance.
12 | type Error struct {
13 | Code int32
14 | Message string
15 | }
16 |
17 | // Error implements the error interface
18 | func (Error) Error() string {
19 | panic(cseNotSupportedMsg)
20 | }
21 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/state.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package mongocrypt
8 |
9 | // State represents a state that a MongocryptContext can be in.
10 | type State int
11 |
12 | // These constants are valid values for the State type.
13 | const (
14 | StateError State = iota
15 | NeedMongoCollInfo
16 | NeedMongoMarkings
17 | NeedMongoKeys
18 | NeedKms
19 | Ready
20 | Done
21 | )
22 |
23 | // String implements the Stringer interface.
24 | func (s State) String() string {
25 | switch s {
26 | case StateError:
27 | return "Error"
28 | case NeedMongoCollInfo:
29 | return "NeedMongoCollInfo"
30 | case NeedMongoMarkings:
31 | return "NeedMongoMarkings"
32 | case NeedMongoKeys:
33 | return "NeedMongoKeys"
34 | case NeedKms:
35 | return "NeedKms"
36 | case Ready:
37 | return "Ready"
38 | case Done:
39 | return "Done"
40 | default:
41 | return "Unknown State"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "AbortTransaction"
3 | documentation = "AbortTransaction performs an abortTransaction operation."
4 |
5 | [properties]
6 | enabled = ["write concern"]
7 | retryable = {mode = "once per command", type = "writes"}
8 |
9 | [command]
10 | name = "abortTransaction"
11 | parameter = "database"
12 |
13 | [request.recoveryToken]
14 | type = "document"
15 | documentation = """
16 | RecoveryToken sets the recovery token to use when committing or aborting a sharded transaction.\
17 | """
18 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "CommitTransaction"
3 | documentation = "CommitTransaction attempts to commit a transaction."
4 |
5 | [properties]
6 | enabled = ["write concern"]
7 | disabled = ["collection"]
8 | retryable = {mode = "once per command", type = "writes"}
9 |
10 | [command]
11 | name = "commitTransaction"
12 | parameter = "database"
13 |
14 | [request.recoveryToken]
15 | type = "document"
16 | documentation = """
17 | RecoveryToken sets the recovery token to use when committing or aborting a sharded transaction.\
18 | """
19 |
20 | [request.maxTimeMS]
21 | type = "int64"
22 | documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run."
23 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "Count"
3 | documentation = "Performs a count operation"
4 |
5 | [properties]
6 | enabled = ["read concern", "read preference"]
7 | retryable = {mode = "once per command", type = "reads"}
8 |
9 | [command]
10 | name = "count"
11 | parameter = "collection"
12 |
13 | [request.maxTimeMS]
14 | type = "int64"
15 | documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run."
16 |
17 | [request.query]
18 | type = "document"
19 | documentation = "Query determines what results are returned from find."
20 |
21 | [response]
22 | name = "CountResult"
23 |
24 | [response.field.n]
25 | type = "int64"
26 | documentation = "The number of documents found"
27 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "CreateIndexes"
3 | documentation = "CreateIndexes performs a createIndexes operation."
4 |
5 | [properties]
6 | enabled = ["write concern"]
7 |
8 | [command]
9 | name = "createIndexes"
10 | parameter = "collection"
11 |
12 | [request.indexes]
13 | type = "array"
14 | constructor = true
15 | documentation = "An array containing index specification documents for the indexes being created."
16 |
17 | [request.maxTimeMS]
18 | type = "int64"
19 | documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run."
20 |
21 | [response]
22 | name = "CreateIndexesResult"
23 |
24 | [response.field.createdCollectionAutomatically]
25 | type = "boolean"
26 | documentation = "If the collection was created automatically."
27 |
28 | [response.field.indexesBefore]
29 | type = "int32"
30 | documentation = "The number of indexes existing before this command."
31 |
32 | [response.field.indexesAfter]
33 | type = "int32"
34 | documentation = "The number of indexes existing after this command."
35 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "Distinct"
3 | documentation = "Distinct performs a distinct operation."
4 |
5 | [properties]
6 | enabled = ["read concern", "read preference"]
7 | retryable = {mode = "once per command", type = "reads"}
8 |
9 | [command]
10 | name = "distinct"
11 | parameter = "collection"
12 |
13 | [request.key]
14 | type = "string"
15 | constructor = true
16 | documentation = "Key specifies which field to return distinct values for."
17 |
18 | [request.query]
19 | type = "document"
20 | constructor = true
21 | documentation = "Query specifies which documents to return distinct values from."
22 |
23 | [request.maxTimeMS]
24 | type = "int64"
25 | documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run."
26 |
27 | [request.collation]
28 | type = "document"
29 | minWireVersionRequired = 5
30 | documentation = "Collation specifies a collation to be used."
31 |
32 | [response]
33 | name = "DistinctResult"
34 |
35 | [response.field.values]
36 | type = "value"
37 | documentation = "The distinct values for the field."
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "DropCollection"
3 | documentation = "DropCollection performs a drop operation."
4 |
5 | [command]
6 | name = "drop"
7 | parameter = "collection"
8 |
9 | [properties]
10 | enabled = ["write concern"]
11 |
12 | [response]
13 | name = "DropCollectionResult"
14 |
15 | [response.field.ns]
16 | type = "string"
17 | documentation = "The namespace of the dropped collection."
18 |
19 | [response.field.nIndexesWas]
20 | type = "int32"
21 | documentation = "The number of indexes in the dropped collection."
22 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "DropDatabase"
3 | documentation = "DropDatabase performs a dropDatabase operation"
4 |
5 | [properties]
6 | enabled = ["write concern"]
7 | disabled = ["collection"]
8 |
9 | [command]
10 | name = "dropDatabase"
11 | parameter = "database"
12 |
13 | [response]
14 | name = "DropDatabaseResult"
15 |
16 | [response.field.dropped]
17 | type = "string"
18 | documentation = "The dropped database."
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "DropIndexes"
3 | documentation = "DropIndexes performs an dropIndexes operation."
4 |
5 | [properties]
6 | enabled = ["write concern"]
7 |
8 | [command]
9 | name = "dropIndexes"
10 | parameter = "collection"
11 |
12 | [request.index]
13 | type = "string"
14 | constructor = true
15 | documentation = """
16 | Index specifies the name of the index to drop. If '*' is specified, all indexes will be dropped.
17 | """
18 |
19 | [request.maxTimeMS]
20 | type = "int64"
21 | documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run."
22 |
23 | [response]
24 | name = "DropIndexesResult"
25 |
26 | [response.field.nIndexesWas]
27 | type = "int32"
28 | documentation = "Number of indexes that existed before the drop was executed."
29 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "EndSessions"
3 | documentation = "EndSessions performs an endSessions operation."
4 |
5 | [properties]
6 | disabled = ["collection"]
7 |
8 | [command]
9 | name = "endSessions"
10 | parameter = "sessionIDs"
11 |
12 | [request.sessionIDs]
13 | type = "array"
14 | documentation = "sessionIDs specify the sessions to be expired."
15 | skip = true
16 | constructor = true
17 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "ListDatabases"
3 | documentation = "ListDatabases performs a listDatabases operation."
4 |
5 | [properties]
6 | enabled = ["read preference"]
7 | retryable = {mode = "once per command", type = "reads"}
8 | disabled = ["collection"]
9 |
10 | [command]
11 | name = "listDatabases"
12 | parameter = "database"
13 |
14 | [request.filter]
15 | type = "document"
16 | constructor = true
17 | documentation = "Filter determines what results are returned from listDatabases."
18 |
19 |
20 | [request.nameOnly]
21 | type = "boolean"
22 | documentation = "NameOnly specifies whether to only return database names."
23 |
24 | [response]
25 | name = "ListDatabasesResult"
26 |
27 | [response.field.totalSize]
28 | type = "int64"
29 | documentation = "The sum of the size of all the database files on disk in bytes."
30 |
31 | [response.field.databases]
32 | type = "value"
33 | documentation = "An array of documents, one document for each database"
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "ListCollections"
3 | documentation = "ListCollections performs a listCollections operation."
4 | response.type = "list collections batch cursor"
5 |
6 | [properties]
7 | enabled = ["read preference"]
8 | disabled = ["collection"]
9 | retryable = {mode = "once per command", type = "reads"}
10 | legacy = "listCollections"
11 |
12 | [command]
13 | name = "listCollections"
14 | parameter = "database"
15 |
16 | [request.filter]
17 | type = "document"
18 | constructor = true
19 | documentation = "Filter determines what results are returned from listCollections."
20 |
21 | [request.nameOnly]
22 | type = "boolean"
23 | documentation = "NameOnly specifies whether to only return collection names."
24 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.toml:
--------------------------------------------------------------------------------
1 | version = 0
2 | name = "ListIndexes"
3 | documentation = "ListIndexes performs a listIndexes operation."
4 | response.type = "batch cursor"
5 |
6 | [properties]
7 | legacy = "listIndexes"
8 | retryable = {mode = "once per command", type = "reads"}
9 |
10 | [command]
11 | name = "listIndexes"
12 | parameter = "collection"
13 |
14 | [request.batchSize]
15 | type = "int32"
16 | documentation = "BatchSize specifies the number of documents to return in every batch."
17 |
18 | [request.maxTimeMS]
19 | type = "int64"
20 | documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run."
21 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/operation.go:
--------------------------------------------------------------------------------
1 | package operation
2 |
3 | //go:generate operationgen insert.toml operation insert.go
4 | //go:generate operationgen find.toml operation find.go
5 | //go:generate operationgen list_collections.toml operation list_collections.go
6 | //go:generate operationgen createIndexes.toml operation createIndexes.go
7 | //go:generate operationgen drop_collection.toml operation drop_collection.go
8 | //go:generate operationgen distinct.toml operation distinct.go
9 | //go:generate operationgen delete.toml operation delete.go
10 | //go:generate operationgen drop_indexes.toml operation drop_indexes.go
11 | //go:generate operationgen drop_database.toml operation drop_database.go
12 | //go:generate operationgen commit_transaction.toml operation commit_transaction.go
13 | //go:generate operationgen abort_transaction.toml operation abort_transaction.go
14 | //go:generate operationgen count.toml operation count.go
15 | //go:generate operationgen end_sessions.toml operation end_sessions.go
16 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/cluster_clock.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package session
8 |
9 | import (
10 | "sync"
11 |
12 | "go.mongodb.org/mongo-driver/bson"
13 | )
14 |
15 | // ClusterClock represents a logical clock for keeping track of cluster time.
16 | type ClusterClock struct {
17 | clusterTime bson.Raw
18 | lock sync.Mutex
19 | }
20 |
21 | // GetClusterTime returns the cluster's current time.
22 | func (cc *ClusterClock) GetClusterTime() bson.Raw {
23 | var ct bson.Raw
24 | cc.lock.Lock()
25 | ct = cc.clusterTime
26 | cc.lock.Unlock()
27 |
28 | return ct
29 | }
30 |
31 | // AdvanceClusterTime updates the cluster's current time.
32 | func (cc *ClusterClock) AdvanceClusterTime(clusterTime bson.Raw) {
33 | cc.lock.Lock()
34 | cc.clusterTime = MaxClusterTime(cc.clusterTime, clusterTime)
35 | cc.lock.Unlock()
36 | }
37 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_legacy.go:
--------------------------------------------------------------------------------
1 | package topology
2 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_legacy_command_metadata.go:
--------------------------------------------------------------------------------
1 | package topology
2 |
3 | import "time"
4 |
5 | // commandMetadata contains metadata about a command sent to the server.
6 | type commandMetadata struct {
7 | Name string
8 | Time time.Time
9 | Legacy bool
10 | FullCollectionName string
11 | }
12 |
13 | // createMetadata creates metadata for a command.
14 | func createMetadata(name string, legacy bool, fullCollName string) *commandMetadata {
15 | return &commandMetadata{
16 | Name: name,
17 | Time: time.Now(),
18 | Legacy: legacy,
19 | FullCollectionName: fullCollName,
20 | }
21 | }
22 |
23 | // TimeDifference returns the difference between now and the time a command was sent in nanoseconds.
24 | func (cm *commandMetadata) TimeDifference() int64 {
25 | t := time.Now()
26 | duration := t.Sub(cm.Time)
27 | return duration.Nanoseconds()
28 | }
29 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/errors.go:
--------------------------------------------------------------------------------
1 | package topology
2 |
3 | import "fmt"
4 |
5 | // ConnectionError represents a connection error.
6 | type ConnectionError struct {
7 | ConnectionID string
8 | Wrapped error
9 |
10 | // init will be set to true if this error occured during connection initialization or
11 | // during a connection handshake.
12 | init bool
13 | message string
14 | }
15 |
16 | // Error implements the error interface.
17 | func (e ConnectionError) Error() string {
18 | if e.Wrapped != nil {
19 | return fmt.Sprintf("connection(%s) %s: %s", e.ConnectionID, e.message, e.Wrapped.Error())
20 | }
21 | return fmt.Sprintf("connection(%s) %s", e.ConnectionID, e.message)
22 | }
23 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options_1_10.go:
--------------------------------------------------------------------------------
1 | // +build go1.10
2 |
3 | package topology
4 |
5 | import "crypto/x509"
6 |
7 | func x509CertSubject(cert *x509.Certificate) string {
8 | return cert.Subject.String()
9 | }
10 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options_1_9.go:
--------------------------------------------------------------------------------
1 | // +build !go1.10
2 |
3 | package topology
4 |
5 | import (
6 | "crypto/x509"
7 | )
8 |
9 | // We don't support version less then 1.10, but Evergreen needs to be able to compile the driver
10 | // using version 1.8.
11 | func x509CertSubject(cert *x509.Certificate) string {
12 | return ""
13 | }
14 |
--------------------------------------------------------------------------------
/services/community/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/uuid/uuid.go:
--------------------------------------------------------------------------------
1 | // Copyright (C) MongoDB, Inc. 2017-present.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | package uuid // import "go.mongodb.org/mongo-driver/x/mongo/driver/uuid"
8 |
9 | import (
10 | "bytes"
11 | "crypto/rand"
12 | "io"
13 | )
14 |
15 | // UUID represents a UUID.
16 | type UUID [16]byte
17 |
18 | var rander = rand.Reader
19 |
20 | // New generates a new uuid.
21 | func New() (UUID, error) {
22 | var uuid [16]byte
23 |
24 | _, err := io.ReadFull(rander, uuid[:])
25 | if err != nil {
26 | return [16]byte{}, err
27 | }
28 | uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
29 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
30 |
31 | return uuid, nil
32 | }
33 |
34 | // Equal returns true if two UUIDs are equal.
35 | func Equal(a, b UUID) bool {
36 | return bytes.Equal([]byte(a[:]), []byte(b[:]))
37 | }
38 |
--------------------------------------------------------------------------------
/services/community/vendor/golang.org/x/crypto/AUTHORS:
--------------------------------------------------------------------------------
1 | # This source code refers to The Go Authors for copyright purposes.
2 | # The master list of authors is in the main Go distribution,
3 | # visible at https://tip.golang.org/AUTHORS.
4 |
--------------------------------------------------------------------------------
/services/community/vendor/golang.org/x/crypto/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # This source code was written by the Go contributors.
2 | # The master list of contributors is in the main Go distribution,
3 | # visible at https://tip.golang.org/CONTRIBUTORS.
4 |
--------------------------------------------------------------------------------
/services/community/vendor/golang.org/x/crypto/bcrypt/base64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package bcrypt
6 |
7 | import "encoding/base64"
8 |
9 | const alphabet = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
10 |
11 | var bcEncoding = base64.NewEncoding(alphabet)
12 |
13 | func base64Encode(src []byte) []byte {
14 | n := bcEncoding.EncodedLen(len(src))
15 | dst := make([]byte, n)
16 | bcEncoding.Encode(dst, src)
17 | for dst[n-1] == '=' {
18 | n--
19 | }
20 | return dst[:n]
21 | }
22 |
23 | func base64Decode(src []byte) ([]byte, error) {
24 | numOfEquals := 4 - (len(src) % 4)
25 | for i := 0; i < numOfEquals; i++ {
26 | src = append(src, '=')
27 | }
28 |
29 | dst := make([]byte, bcEncoding.DecodedLen(len(src)))
30 | n, err := bcEncoding.Decode(dst, src)
31 | if err != nil {
32 | return nil, err
33 | }
34 | return dst[:n], nil
35 | }
36 |
--------------------------------------------------------------------------------
/services/community/vendor/golang.org/x/sync/AUTHORS:
--------------------------------------------------------------------------------
1 | # This source code refers to The Go Authors for copyright purposes.
2 | # The master list of authors is in the main Go distribution,
3 | # visible at http://tip.golang.org/AUTHORS.
4 |
--------------------------------------------------------------------------------
/services/community/vendor/golang.org/x/sync/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # This source code was written by the Go contributors.
2 | # The master list of contributors is in the main Go distribution,
3 | # visible at http://tip.golang.org/CONTRIBUTORS.
4 |
--------------------------------------------------------------------------------
/services/community/vendor/golang.org/x/text/AUTHORS:
--------------------------------------------------------------------------------
1 | # This source code refers to The Go Authors for copyright purposes.
2 | # The master list of authors is in the main Go distribution,
3 | # visible at http://tip.golang.org/AUTHORS.
4 |
--------------------------------------------------------------------------------
/services/community/vendor/golang.org/x/text/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # This source code was written by the Go contributors.
2 | # The master list of contributors is in the main Go distribution,
3 | # visible at http://tip.golang.org/CONTRIBUTORS.
4 |
--------------------------------------------------------------------------------
/services/gateway-service/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM golang:1.21-bookworm AS builder
2 | WORKDIR /app
3 |
4 | COPY go.* ./
5 | RUN go mod download
6 |
7 | COPY . ./
8 |
9 | # Build the binary.
10 | RUN go build -v -o server
11 |
12 | RUN wget https://github.com/minio/certgen/releases/latest/download/certgen-linux-amd64 -O /tmp/certgen \
13 | && chmod +x /tmp/certgen
14 |
15 | RUN /tmp/certgen -host "127.0.0.1,gateway-service,api.mypremiumdealership.com,mypremiumdealership.com"
16 | RUN ls -la
17 |
18 | FROM debian:bookworm-slim
19 | SHELL ["/bin/bash", "-c"]
20 | WORKDIR /app
21 |
22 | RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
23 | ca-certificates && \
24 | rm -rf /var/lib/apt/lists/*
25 |
26 | # Copy the binary to the production image from the builder stage.
27 | COPY --from=builder /app/server /app/server
28 | COPY --from=builder /app/public.crt /app/server.crt
29 | COPY --from=builder /app/private.key /app/server.key
30 |
31 | EXPOSE 443
32 |
33 | CMD ["/app/server"]
34 |
35 |
--------------------------------------------------------------------------------
/services/gateway-service/build-image.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d identity
3 | cmd /c docker build -t crapi/gateway-service:%VERSION% .
4 | cd /d .\..\
5 |
--------------------------------------------------------------------------------
/services/gateway-service/build-image.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Licensed under the Apache License, Version 2.0 (the “License”);
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an “AS IS” BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | set -x
17 | cd "$(dirname $0)"
18 | docker build -t crapi/gateway-service:${VERSION:-latest} .
19 | retVal=$?
20 | if [ $retVal -ne 0 ]; then
21 | echo "Error building crapi-ownership-external image"
22 | exit $retVal
23 | fi
24 |
--------------------------------------------------------------------------------
/services/gateway-service/go.mod:
--------------------------------------------------------------------------------
1 | module api.mypremiumdealership.com/v1
2 |
3 | go 1.19
4 |
5 | require (
6 | github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
7 | github.com/dustin/go-humanize v1.0.1 // indirect
8 | github.com/jaswdr/faker v1.16.0 // indirect
9 | )
10 |
--------------------------------------------------------------------------------
/services/gateway-service/go.sum:
--------------------------------------------------------------------------------
1 | github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 h1:GKTyiRCL6zVf5wWaqKnf+7Qs6GbEPfd4iMOitWzXJx8=
2 | github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8/go.mod h1:spo1JLcs67NmW1aVLEgtA8Yy1elc+X8y5SRW1sFW4Og=
3 | github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
4 | github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
5 | github.com/jaswdr/faker v1.16.0 h1:5ZjusQbqIZwJnUymPirNKJI1yFCuozdSR9oeYPgD5Uk=
6 | github.com/jaswdr/faker v1.16.0/go.mod h1:x7ZlyB1AZqwqKZgyQlnqEG8FDptmHlncA5u2zY/yi6w=
7 |
--------------------------------------------------------------------------------
/services/gencert.sh:
--------------------------------------------------------------------------------
1 | openssl req -x509 -newkey rsa:4096 -keyout certs/server.key -out certs/server.crt -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=$1"
2 |
--------------------------------------------------------------------------------
/services/identity/.env:
--------------------------------------------------------------------------------
1 | export DB_PASSWORD=crapisecretpassword
2 | export SMTP_AUTH=true
3 | export SMTP_STARTTLS=true
4 | export MAILHOG_DOMAIN=example.com
5 | export SMTP_EMAIL=user@example.com
6 | export MAILHOG_PORT=1025
7 | export DB_PORT=5432
8 | export DB_USER=admin
9 | export LANG=C.UTF-8
10 | export SMTP_PASS=xxxxxxxxxxxxxx
11 | export MAILHOG_HOST=127.0.0.1
12 | export SMTP_PORT=587
13 | export ENABLE_LOG4J=false
14 | export DB_HOST=127.0.0.1
15 | export JAVA_TOOL_OPTIONS=-Xmx2048m
16 | export DB_NAME=crapi
17 | export SERVER_PORT=8989
18 | export SMTP_FROM=no-reply@example.com
19 | export ENABLE_SHELL_INJECTION=false
20 | export JWT_SECRET=crapi
21 | export SMTP_HOST=smtp.example.com
22 | export JWT_EXPIRATION=604800000
23 | export API_GATEWAY_URL=https://api.mypremiumdealership.com
24 | export TLS_ENABLED=false
25 | export TLS_KEYSTORE_TYPE=PKCS12
26 | export TLS_KEYSTORE=classpath:certs/server.p12
27 | export TLS_KEYSTORE_PASSWORD=passw0rd
28 | export TLS_KEY_PASSWORD=passw0rd
29 | export TLS_KEY_ALIAS=identity
30 | export JWKS=$(openssl base64 -in ./jwks.json -A)
31 |
--------------------------------------------------------------------------------
/services/identity/.java-version:
--------------------------------------------------------------------------------
1 | 17
2 |
--------------------------------------------------------------------------------
/services/identity/build-image.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d identity
3 | cmd /c docker build -t crapi/crapi-identity:%VERSION% .
4 | cd /d .\..\
5 |
--------------------------------------------------------------------------------
/services/identity/build-image.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Licensed under the Apache License, Version 2.0 (the “License”);
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an “AS IS” BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | set -x
17 | cd "$(dirname $0)"
18 | docker build -t crapi/crapi-identity:${VERSION:-latest} .
19 | retVal=$?
20 | if [ $retVal -ne 0 ]; then
21 | echo "Error building crapi-identity image"
22 | exit $retVal
23 | fi
--------------------------------------------------------------------------------
/services/identity/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | if [ -f /app/keys/jwks.json ]; then
5 | echo "Loading JWKS key file /app/keys/jwks.json"
6 | JWKS=$(openssl base64 -in /app/keys/jwks.json -A)
7 | else
8 | echo "Loading default JWKS file."
9 | JWKS=$(openssl base64 -in /app/default_jwks.json -A)
10 | fi
11 | java -jar /app/identity-service-1.0-SNAPSHOT.jar --app.jwksJson=$JWKS
12 |
13 | exec "$@"
14 |
--------------------------------------------------------------------------------
/services/identity/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs= \
2 | --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
3 | --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
4 | --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
5 | --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
6 | --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
7 | -XX\:MaxHeapSize\=1024m -Xmx1024m
8 |
--------------------------------------------------------------------------------
/services/identity/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/identity/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/services/identity/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/services/identity/health.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | SCHEME="http"
3 | if [ "$TLS_ENABLED" = "true" ] || [ "$TLS_ENABLED" = "1" ]; then
4 | SCHEME="https"
5 | fi
6 | curl -k $SCHEME://0.0.0.0:${SERVER_PORT:-8000}/identity/health_check
7 |
--------------------------------------------------------------------------------
/services/identity/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | *
6 | * Detailed information about configuring a multi-project build in Gradle can be found
7 | * in the user manual at https://docs.gradle.org/7.3.3/userguide/multi_project_builds.html
8 | */
9 |
10 | rootProject.name = "identity-service"
11 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/config/SSLConfig.java:
--------------------------------------------------------------------------------
1 | package com.crapi.config;
2 |
3 | import jakarta.validation.constraints.AssertTrue;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.validation.annotation.Validated;
6 |
7 | @Validated
8 | @ConfigurationProperties("server.ssl")
9 | public class SSLConfig {
10 | private Boolean enabled;
11 |
12 | @AssertTrue
13 | boolean isEmabledValid() {
14 | return enabled != null;
15 | }
16 |
17 | public Boolean getEnabled() {
18 | return enabled;
19 | }
20 |
21 | public void setEnabled(String enabled) {
22 | if (enabled != null) {
23 | if (enabled.equalsIgnoreCase("true")
24 | || enabled.equalsIgnoreCase("yes")
25 | || enabled.equalsIgnoreCase("1")) {
26 | this.enabled = true;
27 | System.out.println("TLS Enabled");
28 | } else {
29 | this.enabled = false;
30 | System.out.println("TLS Disabled");
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/entity/ChangePhoneRequest.java:
--------------------------------------------------------------------------------
1 | package com.crapi.entity;
2 |
3 | import com.crapi.enums.EStatus;
4 | import jakarta.persistence.*;
5 | import lombok.Data;
6 |
7 | @Entity
8 | @Table(name = "otp_phoneNumberChange")
9 | @Data
10 | public class ChangePhoneRequest {
11 | @Id
12 | @GeneratedValue(strategy = GenerationType.AUTO)
13 | private long id;
14 |
15 | @Column(name = "new_phone")
16 | private String newPhone;
17 |
18 | @Column(name = "old_phone")
19 | private String oldPhone;
20 |
21 | @Column(name = "otp")
22 | private String otp;
23 |
24 | private String status;
25 |
26 | @OneToOne private User user;
27 |
28 | public ChangePhoneRequest() {}
29 |
30 | public ChangePhoneRequest(String newPhone, String oldPhone, String otp, User user) {
31 | this.newPhone = newPhone;
32 | this.oldPhone = oldPhone;
33 | this.otp = otp;
34 | this.user = user;
35 | this.status = EStatus.ACTIVE.toString();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/entity/Otp.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.entity;
16 |
17 | import jakarta.persistence.*;
18 | import lombok.Data;
19 |
20 | @Entity
21 | @Table(name = "otp")
22 | @Data
23 | public class Otp {
24 |
25 | @Id
26 | @GeneratedValue(strategy = GenerationType.AUTO)
27 | private long id;
28 |
29 | private String otp;
30 | private String status;
31 | private int count;
32 |
33 | @OneToOne private User user;
34 |
35 | public Otp() {}
36 |
37 | public Otp(String otp, User user) {
38 | this.otp = otp;
39 | this.user = user;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/entity/VehicleCompany.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.entity;
16 |
17 | import jakarta.persistence.*;
18 | import java.io.Serializable;
19 | import lombok.Data;
20 |
21 | @Entity
22 | @Table(name = "vehicle_company")
23 | @Data
24 | public class VehicleCompany implements Serializable {
25 |
26 | @Id
27 | @GeneratedValue(strategy = GenerationType.AUTO)
28 | private long id;
29 |
30 | private String name;
31 |
32 | public VehicleCompany() {}
33 |
34 | public VehicleCompany(String name) {
35 | this.name = name;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/enums/EFuelType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.enums;
16 |
17 | public enum EFuelType {
18 | CNG,
19 | PETROL,
20 | DIESEL
21 | }
22 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/enums/EStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.enums;
16 |
17 | public enum EStatus {
18 | UPDATED,
19 | ACTIVE,
20 | INACTIVE,
21 | SUCCESS,
22 | ALREADY,
23 | INVALID,
24 | NOTMATCHED,
25 | SENT,
26 | FAILED
27 | }
28 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/ApiKeyResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import lombok.Data;
18 |
19 | @Data
20 | public class ApiKeyResponse {
21 | private String apiKey;
22 | private String type = "ApiKey";
23 | private String message;
24 |
25 | public ApiKeyResponse() {}
26 |
27 | public ApiKeyResponse(String apiKey) {
28 | this.apiKey = apiKey;
29 | }
30 |
31 | public ApiKeyResponse(String apiKey, String message) {
32 | this.apiKey = apiKey;
33 | this.message = message;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/CRAPIResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import lombok.Data;
18 |
19 | @Data
20 | public class CRAPIResponse {
21 |
22 | private String message;
23 | private int status;
24 |
25 | public CRAPIResponse() {}
26 |
27 | public CRAPIResponse(String message) {
28 | this.message = message;
29 | }
30 |
31 | public CRAPIResponse(String message, int status) {
32 | this.message = message;
33 | this.status = status;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/ChangeEmailForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import jakarta.validation.constraints.NotBlank;
18 | import jakarta.validation.constraints.Size;
19 | import lombok.Data;
20 |
21 | @Data
22 | public class ChangeEmailForm {
23 |
24 | @NotBlank
25 | @Size(min = 3, max = 40)
26 | private String old_email;
27 |
28 | @NotBlank
29 | @Size(min = 3, max = 40)
30 | private String new_email;
31 |
32 | private String token;
33 | }
34 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/ChangePhoneForm.java:
--------------------------------------------------------------------------------
1 | package com.crapi.model;
2 |
3 | import jakarta.validation.constraints.NotBlank;
4 | import jakarta.validation.constraints.Size;
5 | import lombok.Data;
6 |
7 | @Data
8 | public class ChangePhoneForm {
9 | @NotBlank
10 | @Size(max = 15)
11 | private String old_number;
12 |
13 | @NotBlank
14 | @Size(max = 15)
15 | private String new_number;
16 |
17 | @Size(min = 3, max = 4)
18 | private String otp;
19 | }
20 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/ErrorDetails.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import lombok.Data;
18 |
19 | @Data
20 | public class ErrorDetails {
21 |
22 | private String message;
23 | private String details;
24 |
25 | public ErrorDetails() {}
26 |
27 | public ErrorDetails(String message, String details) {
28 | super();
29 | this.message = message;
30 | this.details = details;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/ForgetPassword.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import jakarta.validation.constraints.Email;
18 | import jakarta.validation.constraints.NotBlank;
19 | import jakarta.validation.constraints.Size;
20 | import java.io.Serializable;
21 | import lombok.Data;
22 |
23 | @Data
24 | public class ForgetPassword implements Serializable {
25 |
26 | @NotBlank
27 | @Size(min = 3, max = 100)
28 | @Email
29 | private String email;
30 | }
31 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/JwtTokenForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import jakarta.validation.constraints.NotBlank;
18 | import lombok.Data;
19 |
20 | @Data
21 | public class JwtTokenForm {
22 |
23 | @NotBlank private String token;
24 | }
25 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/LockAccountForm.java:
--------------------------------------------------------------------------------
1 | package com.crapi.model;
2 |
3 | import jakarta.validation.constraints.NotBlank;
4 | import jakarta.validation.constraints.Size;
5 | import lombok.Data;
6 |
7 | @Data
8 | public class LockAccountForm {
9 |
10 | @NotBlank
11 | @Size(min = 3, max = 100)
12 | private String email;
13 | }
14 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/LoginForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import jakarta.validation.constraints.NotBlank;
18 | import jakarta.validation.constraints.Size;
19 | import lombok.Data;
20 |
21 | @Data
22 | public class LoginForm {
23 |
24 | @NotBlank
25 | @Size(min = 3, max = 100)
26 | private String email;
27 |
28 | @NotBlank
29 | @Size(min = 4, max = 100)
30 | private String password;
31 |
32 | private String number;
33 | }
34 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/LoginWithEmailToken.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import jakarta.validation.constraints.NotBlank;
18 | import jakarta.validation.constraints.Size;
19 | import lombok.Data;
20 |
21 | @Data
22 | public class LoginWithEmailToken {
23 |
24 | @NotBlank
25 | @Size(min = 3, max = 100)
26 | private String email;
27 |
28 | @NotBlank
29 | @Size(min = 3, max = 100)
30 | private String token;
31 | }
32 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/OtpForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import jakarta.validation.constraints.NotBlank;
18 | import jakarta.validation.constraints.Size;
19 | import lombok.Data;
20 |
21 | @Data
22 | public class OtpForm {
23 | @NotBlank
24 | @Size(min = 3, max = 4)
25 | private String otp;
26 |
27 | @NotBlank
28 | @Size(min = 5, max = 30)
29 | private String password;
30 |
31 | @NotBlank
32 | @Size(min = 5, max = 30)
33 | private String email;
34 | }
35 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/UnlockAccountForm.java:
--------------------------------------------------------------------------------
1 | package com.crapi.model;
2 |
3 | import jakarta.validation.constraints.NotBlank;
4 | import jakarta.validation.constraints.Size;
5 | import lombok.Data;
6 |
7 | @Data
8 | public class UnlockAccountForm {
9 |
10 | @NotBlank
11 | @Size(min = 3, max = 100)
12 | private String email;
13 |
14 | @NotBlank
15 | @Size(min = 8, max = 8)
16 | private String code;
17 | }
18 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/VehicleForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import jakarta.validation.constraints.NotBlank;
18 | import jakarta.validation.constraints.Size;
19 | import lombok.Data;
20 |
21 | @Data
22 | public class VehicleForm {
23 |
24 | @NotBlank
25 | @Size(min = 4, max = 8)
26 | private String pincode;
27 |
28 | @NotBlank
29 | @Size(min = 4, max = 20)
30 | private String vin;
31 | }
32 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/VehicleOwnership.java:
--------------------------------------------------------------------------------
1 | package com.crapi.model;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class VehicleOwnership {
7 | private String vin;
8 | private String rank;
9 | private String name;
10 | private String phone;
11 | private String email;
12 | private String ssn;
13 | private String address;
14 | // map to registration_id from json
15 | private String registration_id;
16 | // map to registration_date from json
17 | private String registration_date;
18 |
19 | public VehicleOwnership() {}
20 | }
21 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/model/VideoForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.model;
16 |
17 | import lombok.Data;
18 |
19 | @Data
20 | public class VideoForm {
21 |
22 | private long id;
23 | private String videoName;
24 | private String video_url;
25 | private String conversion_params;
26 | }
27 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/repository/ChangeEmailRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.repository;
16 |
17 | import com.crapi.entity.ChangeEmailRequest;
18 | import com.crapi.entity.User;
19 | import org.springframework.data.jpa.repository.JpaRepository;
20 | import org.springframework.stereotype.Repository;
21 |
22 | @Repository
23 | public interface ChangeEmailRepository extends JpaRepository {
24 | ChangeEmailRequest findByUser(User user);
25 |
26 | ChangeEmailRequest findByEmailToken(String emailToken);
27 | }
28 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/repository/ChangePhoneRepository.java:
--------------------------------------------------------------------------------
1 | package com.crapi.repository;
2 |
3 | import com.crapi.entity.ChangePhoneRequest;
4 | import com.crapi.entity.User;
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 | import org.springframework.stereotype.Repository;
7 |
8 | @Repository
9 | public interface ChangePhoneRepository extends JpaRepository {
10 | ChangePhoneRequest findByUser(User user);
11 | }
12 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/repository/OtpRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.repository;
16 |
17 | import com.crapi.entity.Otp;
18 | import com.crapi.entity.User;
19 | import org.springframework.data.jpa.repository.JpaRepository;
20 | import org.springframework.stereotype.Repository;
21 |
22 | @Repository
23 | public interface OtpRepository extends JpaRepository {
24 | Otp findByOtpAndStatus(String otp, String status);
25 |
26 | Otp findByUser(User user);
27 | }
28 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/repository/ProfileVideoRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.repository;
16 |
17 | import com.crapi.entity.ProfileVideo;
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 | import org.springframework.stereotype.Repository;
20 |
21 | @Repository
22 | public interface ProfileVideoRepository extends JpaRepository {
23 | ProfileVideo findByUser_id(Long id);
24 | }
25 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/repository/UserDetailsRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.repository;
16 |
17 | import com.crapi.entity.UserDetails;
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 | import org.springframework.stereotype.Repository;
20 |
21 | @Repository
22 | public interface UserDetailsRepository extends JpaRepository {
23 | UserDetails findByUser_id(Long id);
24 | }
25 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/repository/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.repository;
16 |
17 | import com.crapi.entity.User;
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 | import org.springframework.stereotype.Repository;
20 |
21 | @Repository
22 | public interface UserRepository extends JpaRepository {
23 | boolean existsByNumber(String number);
24 |
25 | boolean existsByEmail(String email);
26 |
27 | User findByEmail(String s);
28 |
29 | User findByApiKey(String apiKey);
30 | }
31 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/repository/VehicleCompanyRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.repository;
16 |
17 | import com.crapi.entity.VehicleCompany;
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 | import org.springframework.stereotype.Repository;
20 |
21 | @Repository
22 | public interface VehicleCompanyRepository extends JpaRepository {
23 | VehicleCompany findByName(String name);
24 | }
25 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/repository/VehicleLocationRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.repository;
16 |
17 | import com.crapi.entity.VehicleLocation;
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 | import org.springframework.stereotype.Repository;
20 |
21 | @Repository
22 | public interface VehicleLocationRepository extends JpaRepository {}
23 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/repository/VehicleModelRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.repository;
16 |
17 | import com.crapi.entity.VehicleModel;
18 | import java.util.List;
19 | import org.springframework.data.jpa.repository.JpaRepository;
20 | import org.springframework.stereotype.Repository;
21 |
22 | @Repository
23 | public interface VehicleModelRepository extends JpaRepository {
24 |
25 | List findByVehiclecompany_id(long id);
26 | }
27 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/service/OtpService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.service;
16 |
17 | import com.crapi.entity.Otp;
18 | import com.crapi.model.CRAPIResponse;
19 | import com.crapi.model.ForgetPassword;
20 | import com.crapi.model.OtpForm;
21 |
22 | public interface OtpService {
23 |
24 | boolean invalidateOtp(Otp validateOtp);
25 |
26 | CRAPIResponse generateOtp(ForgetPassword user);
27 |
28 | CRAPIResponse validateOtp(OtpForm otpForm);
29 |
30 | CRAPIResponse secureValidateOtp(OtpForm otpForm);
31 | }
32 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/service/UserRegistrationService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.service;
16 |
17 | import com.crapi.entity.User;
18 | import com.crapi.entity.UserDetails;
19 | import com.crapi.model.*;
20 |
21 | public interface UserRegistrationService {
22 |
23 | CRAPIResponse registerUser(SignUpForm signUpRequest);
24 |
25 | UserDetails createUserDetails(String name, User user);
26 | }
27 |
--------------------------------------------------------------------------------
/services/identity/src/main/java/com/crapi/service/VehicleOwnershipService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the “License”);
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an “AS IS” BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package com.crapi.service;
16 |
17 | import com.crapi.entity.*;
18 | import com.crapi.model.VehicleOwnership;
19 | import java.util.List;
20 |
21 | public interface VehicleOwnershipService {
22 |
23 | List getPreviousOwners(String vin);
24 | }
25 |
--------------------------------------------------------------------------------
/services/identity/src/main/resources/certs/keystore.sh:
--------------------------------------------------------------------------------
1 | rm -f server.p12
2 | rm -f server.keystore
3 | openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12 -name identity -passout pass:passw0rd
4 | keytool -importkeystore -deststorepass passw0rd -destkeypass passw0rd -destkeystore server.keystore -srckeystore server.p12 -srcstoretype PKCS12 -srcstorepass passw0rd -alias identity
5 |
--------------------------------------------------------------------------------
/services/identity/src/main/resources/certs/server.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/identity/src/main/resources/certs/server.keystore
--------------------------------------------------------------------------------
/services/identity/src/main/resources/certs/server.p12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/identity/src/main/resources/certs/server.p12
--------------------------------------------------------------------------------
/services/identity/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %d{yyyy-MM-dd HH:mm:ss} [%thread] %level %logger{35} - %msg%n
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/services/mailhog/Dockerfile:
--------------------------------------------------------------------------------
1 | #
2 | # MailHog Dockerfile
3 | #
4 | FROM golang:alpine AS builder
5 |
6 | # Install MailHog:
7 | RUN apk --no-cache add --virtual build-dependencies \
8 | git \
9 | && mkdir -p /root/gocode \
10 | && export GOPATH=/root/gocode \
11 | && go install github.com/mailhog/MailHog@latest
12 |
13 | FROM alpine:3
14 | # Add mailhog user/group with uid/gid 1000.
15 | # This is a workaround for boot2docker issue #581, see
16 | # https://github.com/boot2docker/boot2docker/issues/581
17 | RUN adduser -D -u 1000 mailhog
18 |
19 | COPY --from=builder /root/gocode/bin/MailHog /usr/local/bin/
20 |
21 | USER mailhog
22 |
23 | WORKDIR /home/mailhog
24 |
25 | ENTRYPOINT ["MailHog"]
26 |
27 | # Expose the SMTP and HTTP ports:
28 | EXPOSE 1025 8025
29 |
--------------------------------------------------------------------------------
/services/mailhog/build-image.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d mailhog
3 | cmd /c docker build -t crapi/mailhog:%VERSION% .
4 | cd /d .\..\
5 |
--------------------------------------------------------------------------------
/services/mailhog/build-image.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2020 Traceable, Inc.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the “License”);
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an “AS IS” BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 |
18 | set -x
19 |
20 | cd "$(dirname $0)"
21 | docker build -t crapi/mailhog:${VERSION:-latest} .
22 |
--------------------------------------------------------------------------------
/services/web/.prettierignore:
--------------------------------------------------------------------------------
1 | # Ignore artifacts:
2 | build
3 | coverage
4 |
--------------------------------------------------------------------------------
/services/web/.prettierrc:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/services/web/build-image.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d web
3 | cmd /c docker build -t crapi/crapi-web:%VERSION% .
4 | cd /d .\..\
5 |
--------------------------------------------------------------------------------
/services/web/build-image.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the “License”);
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an “AS IS” BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | set -x
18 |
19 | cd "$(dirname $0)"
20 | docker build -t crapi/crapi-web:${VERSION:-latest} .
21 | retVal=$?
22 | if [ $retVal -ne 0 ]; then
23 | echo "Error building crapi-web image"
24 | exit $retVal
25 | fi
--------------------------------------------------------------------------------
/services/web/public/.env:
--------------------------------------------------------------------------------
1 | DB_NAME=crapi
2 | DB_USER=crapi
3 | DB_PASSWORD=crapi
4 | DB_HOST=postgresdb
5 | DB_PORT=5432
6 | SERVER_PORT=8080
7 | MONGO_DB_HOST=mongodb
8 | MONGO_DB_PORT=27017
9 | MONGO_DB_USER=crapi
10 | MONGO_DB_PASSWORD=crapi
11 | MONGO_DB_NAME=crapi
12 |
--------------------------------------------------------------------------------
/services/web/public/images/audi-rs7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/public/images/audi-rs7.jpg
--------------------------------------------------------------------------------
/services/web/public/images/bmw-5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/public/images/bmw-5.jpg
--------------------------------------------------------------------------------
/services/web/public/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/public/images/favicon.ico
--------------------------------------------------------------------------------
/services/web/public/images/hyundai-creta.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/public/images/hyundai-creta.jpg
--------------------------------------------------------------------------------
/services/web/public/images/lamborghini-aventador.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/public/images/lamborghini-aventador.jpg
--------------------------------------------------------------------------------
/services/web/public/images/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/public/images/logo192.png
--------------------------------------------------------------------------------
/services/web/public/images/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/public/images/logo512.png
--------------------------------------------------------------------------------
/services/web/public/images/mercedesbenz-gla.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/public/images/mercedesbenz-gla.jpg
--------------------------------------------------------------------------------
/services/web/public/images/mgmotor-hectorplus.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/public/images/mgmotor-hectorplus.jpg
--------------------------------------------------------------------------------
/services/web/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "images/favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "images/logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "images/logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/services/web/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/services/web/src/actions/mechanicActions.ts:
--------------------------------------------------------------------------------
1 | import actionTypes from "../constants/actionTypes";
2 |
3 | interface ActionPayload {
4 | accessToken: string;
5 | callback: (res: any, data?: any) => void;
6 | [key: string]: any;
7 | }
8 |
9 | export const createCommentAction = ({
10 | accessToken,
11 | serviceId,
12 | comment,
13 | callback,
14 | ...data
15 | }: ActionPayload) => {
16 | return {
17 | type: actionTypes.CREATE_SERVICE_COMMENT,
18 | payload: { accessToken, serviceId, comment, ...data, callback },
19 | };
20 | };
21 |
22 | export const updateServiceRequestStatusAction = ({
23 | accessToken,
24 | serviceId,
25 | status,
26 | callback,
27 | ...data
28 | }: ActionPayload) => {
29 | return {
30 | type: actionTypes.UPDATE_SERVICE_REQUEST_STATUS,
31 | payload: { accessToken, serviceId, status, ...data, callback },
32 | };
33 | };
34 |
--------------------------------------------------------------------------------
/services/web/src/assets/default_profile_pic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/web/src/assets/default_profile_pic.png
--------------------------------------------------------------------------------
/services/web/src/components/dashboard/dashboard.css:
--------------------------------------------------------------------------------
1 | .ant-avatar img {
2 | object-fit: scale-down;
3 | }
4 |
5 | .affix-button {
6 | float: right;
7 | }
8 |
9 | .vehicle-desc {
10 | /* text-align: center; */
11 | background-color: #f0f0f0;
12 | }
13 |
14 | .vehicle-desc .ant-descriptions-view {
15 | width: auto;
16 | }
17 |
18 | .vehicle-desc .ant-descriptions-item-label {
19 | background: none;
20 | width: 30%;
21 | }
22 |
23 |
24 | .dashboard-header {
25 | padding-left: 0;
26 | padding-right: 0;
27 | }
28 | .refresh-loc-btn {
29 | width: 400px;
30 | /* left: 30%; */
31 | }
32 |
33 | .map-iframe {
34 | border: 0;
35 | }
36 |
37 | .alert-msg-box {
38 | margin: auto;
39 | text-align: center;
40 | }
41 |
42 | .alert-msg-box .btn {
43 | color: blue;
44 | background-color: transparent;
45 | border: none;
46 | }
47 |
48 | .alert-header {
49 | font-size: larger;
50 | font-weight: bold;
51 | }
52 |
53 | .alert-msg {
54 | font-size: large;
55 | }
56 |
--------------------------------------------------------------------------------
/services/web/src/components/forgotPassword/forgotPassword.css:
--------------------------------------------------------------------------------
1 | .steps-content {
2 | margin-top: 20px;
3 | }
4 |
--------------------------------------------------------------------------------
/services/web/src/components/forum/style.css:
--------------------------------------------------------------------------------
1 | .post-content {
2 | margin-top: 10px;
3 | }
4 |
--------------------------------------------------------------------------------
/services/web/src/components/layout/layout.css:
--------------------------------------------------------------------------------
1 | .layout-content {
2 | padding: 0 50px;
3 | }
4 |
5 | .spinner {
6 | z-index: 1100;
7 | }
8 |
9 | .ant-spin {
10 | z-index: 1100;
11 | }
12 |
--------------------------------------------------------------------------------
/services/web/src/components/login/login.css:
--------------------------------------------------------------------------------
1 | .container {
2 | display: flex;
3 | height: 91vh;
4 | width: 100%;
5 | }
6 |
7 | .alternative-style {
8 | color: #262c6f;
9 | font-size: 12px;
10 | cursor: pointer;
11 | display: flex;
12 | float: right;
13 | box-sizing: border-box;
14 | padding-bottom: 2%;
15 | border: none;
16 | background-color: transparent;
17 | }
18 | .spinner {
19 | max-height: none !important;
20 | }
21 | .error-message {
22 | text-align: left;
23 | color: red;
24 | font-size: 12px;
25 | padding: 15px 0;
26 | }
27 |
28 | .form-card {
29 | border-radius: 5px;
30 | width: 30%;
31 | margin: auto;
32 | min-width: 400px;
33 | }
34 |
35 | .form-button {
36 | width: 100%;
37 | }
38 |
--------------------------------------------------------------------------------
/services/web/src/components/order/styles.css:
--------------------------------------------------------------------------------
1 | .order-desc {
2 | padding: 0 2%;
3 | }
4 |
5 | .order-desc .ant-descriptions-item-label,
6 | .order-desc .ant-descriptions-item-content {
7 | font-size: 18px;
8 | }
9 |
10 | .return-btn {
11 | width: 30%;
12 | margin: 0 35%;
13 | }
14 |
15 | .order-card {
16 | padding: 10px;
17 | }
18 |
--------------------------------------------------------------------------------
/services/web/src/components/pastOrders/styles.css:
--------------------------------------------------------------------------------
1 | .order-desc {
2 | padding: 0 2%;
3 | }
4 |
5 | .order-desc .ant-descriptions-item-label,
6 | .order-desc .ant-descriptions-item-content {
7 | font-size: 18px;
8 | }
9 |
10 | .return-btn {
11 | width: 30%;
12 | margin: 0 35%;
13 | }
14 |
15 | .order-card {
16 | padding-top: 24px;
17 | }
18 |
19 | .order-avatar {
20 | margin: auto;
21 | }
22 |
--------------------------------------------------------------------------------
/services/web/src/components/post/style.css:
--------------------------------------------------------------------------------
1 | .post-header {
2 | padding-bottom: 0;
3 | }
4 |
5 | .post-subtitle {
6 | padding: 0;
7 | }
8 |
9 | .comment-heading {
10 | padding-top: 0;
11 | }
12 |
13 | .comment-title {
14 | padding: 0;
15 | }
16 |
17 | .comment-row {
18 | align-items: center;
19 | }
20 |
--------------------------------------------------------------------------------
/services/web/src/components/profile/profile.css:
--------------------------------------------------------------------------------
1 | .avatar-uploader {
2 | width: auto;
3 | margin-left: 10px;
4 | }
5 |
6 | .page-container {
7 | width: 65%;
8 | min-width: 900px;
9 | margin: auto;
10 | }
11 |
12 | .profile-header {
13 | padding-left: 0;
14 | }
15 |
16 | .change-email-btn {
17 | margin-left: 50px;
18 | }
19 |
20 | .change-phone-number-btn {
21 | margin-left: 50px;
22 | }
23 |
24 | .profile-video {
25 | width: 60%;
26 | }
27 |
28 | .more-icon {
29 | color: black;
30 | font-size: x-large;
31 | }
32 |
33 | .upload-video-button {
34 | width: 100%;
35 | height: 100%;
36 | min-width: 900px;
37 | align-items: center;
38 | justify-content: center;
39 | display: flex;
40 | margin-top: 40px;
41 | }
42 | .button {
43 | align-items: center;
44 | }
45 |
--------------------------------------------------------------------------------
/services/web/src/components/shop/styles.css:
--------------------------------------------------------------------------------
1 | .page-header {
2 | padding-left: 0;
3 | padding-right: 0;
4 | }
5 |
6 | .balance-desc span {
7 | font-size: 20px;
8 | font-weight: bold;
9 | }
10 |
11 | .balance-desc .ant-descriptions-item-content {
12 | color: darkgreen;
13 | }
14 |
15 | .product-card {
16 | padding-top: 24px;
17 | }
18 |
19 | .product-avatar {
20 | margin: auto;
21 | }
22 |
23 | .product-card .ant-page-header-heading-left {
24 | margin: auto;
25 | }
26 |
27 | .product-card .ant-page-header-heading-title {
28 | margin-right: 0;
29 | }
30 |
31 | .buy-btn {
32 | width: 30%;
33 | margin: 0 35%;
34 | }
35 |
36 | /* .product-desc span{
37 | font-size: medium;
38 | }
39 |
40 | .product-desc .ant-descriptions-item{
41 | padding-left: 24px;
42 | } */
43 |
--------------------------------------------------------------------------------
/services/web/src/components/unlock/unlock.css:
--------------------------------------------------------------------------------
1 | .container {
2 | display: flex;
3 | height: 91vh;
4 | width: 100%;
5 | }
6 |
7 | .alternative-style {
8 | color: #262c6f;
9 | font-size: 12px;
10 | cursor: pointer;
11 | display: flex;
12 | float: left;
13 | box-sizing: border-box;
14 | padding-bottom: 2%;
15 | border: none;
16 | background-color: transparent;
17 | }
18 |
19 | .alternative-style {
20 | color: #262c6f;
21 | font-size: 12px;
22 | cursor: pointer;
23 | display: flex;
24 | float: right;
25 | box-sizing: border-box;
26 | padding-bottom: 2%;
27 | border: none;
28 | background-color: transparent;
29 | }
30 | .spinner {
31 | max-height: none !important;
32 | }
33 | .error-message {
34 | text-align: left;
35 | color: red;
36 | font-size: 12px;
37 | padding: 15px 0;
38 | }
39 |
40 | .form-card {
41 | border-radius: 5px;
42 | width: 30%;
43 | margin: auto;
44 | min-width: 400px;
45 | }
46 |
47 | .form-button {
48 | width: 100%;
49 | }
50 |
--------------------------------------------------------------------------------
/services/web/src/config.ts:
--------------------------------------------------------------------------------
1 | export const crapienv: {
2 | IDENTITY_SERVICE: string;
3 | WORKSHOP_SERVICE: string;
4 | CHATBOT_SERVICE: string;
5 | COMMUNITY_SERVICE: string;
6 | } = {
7 | IDENTITY_SERVICE: "identity/",
8 | WORKSHOP_SERVICE: "workshop/",
9 | CHATBOT_SERVICE: "chatbot/",
10 | COMMUNITY_SERVICE: "community/",
11 | };
12 |
--------------------------------------------------------------------------------
/services/web/src/config.ts.template:
--------------------------------------------------------------------------------
1 | export const crapienv: {
2 | IDENTITY_SERVICE: string;
3 | WORKSHOP_SERVICE: string;
4 | COMMUNITY_SERVICE: string;
5 | } = {
6 | IDENTITY_SERVICE: "identity/",
7 | WORKSHOP_SERVICE: "workshop/",
8 | COMMUNITY_SERVICE: "community/",
9 | };
10 |
--------------------------------------------------------------------------------
/services/web/src/constants/responseTypes.ts:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | const responseTypes = {
17 | SUCCESS: "success",
18 | FAILURE: "failure",
19 | LOGOUT: "logout",
20 | REDIRECT: "redirect",
21 | } as const;
22 |
23 | type ResponseTypes = typeof responseTypes;
24 |
25 | export default responseTypes;
26 | export type { ResponseTypes };
27 |
--------------------------------------------------------------------------------
/services/web/src/constants/roleTypes.ts:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | const roleTypes = {
17 | ROLE_USER: "ROLE_USER",
18 | ROLE_MECHANIC: "ROLE_MECHANIC",
19 | ROLE_ADMIN: "ROLE_ADMIN",
20 | } as const;
21 |
22 | type RoleTypes = typeof roleTypes;
23 |
24 | export default roleTypes;
25 | export type { RoleTypes };
26 |
--------------------------------------------------------------------------------
/services/web/src/containers/profile/profile.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | import React from "react";
17 | import { connect, ConnectedProps } from "react-redux";
18 | import Profile from "../../components/profile/profile";
19 |
20 | interface RootState {}
21 |
22 | const mapStateToProps = (state: RootState) => ({});
23 |
24 | const connector = connect(mapStateToProps);
25 |
26 | type PropsFromRedux = ConnectedProps;
27 |
28 | const ProfileContainer: React.FC = () => {
29 | return ;
30 | };
31 |
32 | export default connector(ProfileContainer);
33 |
--------------------------------------------------------------------------------
/services/web/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/services/web/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/services/web/src/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "./dist",
4 | "allowJs": true,
5 | "target": "es5"
6 | },
7 | "include": ["./src/**/*"]
8 | }
9 |
--------------------------------------------------------------------------------
/services/web/src/types/action.ts:
--------------------------------------------------------------------------------
1 | interface MyAction {
2 | type: string;
3 | payload: any;
4 | }
5 |
6 | export default MyAction;
7 |
--------------------------------------------------------------------------------
/services/web/src/utils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | export const getMapUrl = (lat: number, long: number): string =>
17 | `https://maps.google.com/maps?q=${lat},${long}&output=embed`;
18 |
19 | export const isAccessTokenValid = (token: string): boolean => {
20 | return true;
21 | };
22 |
23 | export const formatDateFromIso = (isoDate: string): string => {
24 | const date = new Date(isoDate);
25 | return date.toDateString();
26 | };
27 |
--------------------------------------------------------------------------------
/services/web/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "esModuleInterop": true,
8 | "allowSyntheticDefaultImports": true,
9 | "strict": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "noEmit": true,
16 | "jsx": "react"
17 | },
18 | "include": ["src"]
19 | }
20 |
--------------------------------------------------------------------------------
/services/web/webpack.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | entry: "./src/index.ts",
3 | output: {
4 | filename: "./dist/bundle.js",
5 | },
6 | // Enable sourcemaps for debugging webpack's output.
7 | devtool: "source-map",
8 | resolve: {
9 | // Add '.ts' and '.tsx' as resolvable extensions.
10 | extensions: ["", ".webpack.js", ".web.js", ".ts", ".tsx", ".js"],
11 | fallback: {
12 | crypto: false,
13 | stream: false,
14 | util: false,
15 | path: false,
16 | os: false,
17 | fs: false,
18 | url: false,
19 | buffer: false,
20 | zlib: false,
21 | http: false,
22 | https: false,
23 | },
24 | },
25 | module: {
26 | rules: [
27 | // All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
28 | { test: /\.tsx?$/, loader: "ts-loader" },
29 | // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
30 | { test: /\.js$/, loader: "source-map-loader" },
31 | ],
32 | },
33 | // Other options...
34 | };
35 |
--------------------------------------------------------------------------------
/services/workshop/.dockerignore:
--------------------------------------------------------------------------------
1 | debug.log
2 | Dockerfile
3 |
--------------------------------------------------------------------------------
/services/workshop/.env:
--------------------------------------------------------------------------------
1 | export DB_DRIVER=postgres
2 | export DB_HOST=127.0.0.1
3 | export DB_NAME=crapi
4 | export DB_PASSWORD=crapisecretpassword
5 | export DB_PORT="5432"
6 | export DB_USER=admin
7 | export IDENTITY_SERVICE=127.0.0.1:8080
8 | export MONGO_DB_DRIVER=mongodb
9 | export MONGO_DB_HOST=127.0.0.1
10 | export MONGO_DB_NAME=crapi
11 | export MONGO_DB_PASSWORD=crapisecretpassword
12 | export MONGO_DB_PORT="27017"
13 | export MONGO_DB_USER=admin
14 | export SECRET_KEY=crapi
15 | export SERVER_PORT="8000"
16 | export API_GATEWAY_URL="https://api.mypremiumdealership.com"
17 | export TLS_ENABLED=false
18 |
--------------------------------------------------------------------------------
/services/workshop/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/build-image.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d workshop
3 | cmd /c docker build -t crapi/crapi-workshop:%VERSION% .
4 | cd /d .\..\..\
5 |
--------------------------------------------------------------------------------
/services/workshop/build-image.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the “License”);
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an “AS IS” BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | set -x
18 | cd "$(dirname $0)"
19 | docker build -t crapi/crapi-workshop:${VERSION:-latest} .
20 | retVal=$?
21 | if [ $retVal -ne 0 ]; then
22 | echo "Error building crapi-workshop image"
23 | fi
24 | exit $retVal
--------------------------------------------------------------------------------
/services/workshop/core/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/workshop/core/__init__.py
--------------------------------------------------------------------------------
/services/workshop/core/management/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/workshop/core/management/__init__.py
--------------------------------------------------------------------------------
/services/workshop/crapi/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/crapi/admin.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 |
15 | """
16 | Register the models here to view the same in Django Admin.
17 | """
18 | from django.contrib import admin
19 |
20 | from crapi.mechanic.models import ServiceRequest, Mechanic
21 | from crapi.shop.models import Order, Product, AppliedCoupon
22 | from crapi.user.models import User, UserDetails, Vehicle
23 |
24 | admin.site.register(Order)
25 | admin.site.register(User)
26 | admin.site.register(Product)
27 | admin.site.register(AppliedCoupon)
28 | admin.site.register(Mechanic)
29 | admin.site.register(ServiceRequest)
30 | admin.site.register(UserDetails)
31 | admin.site.register(Vehicle)
32 |
--------------------------------------------------------------------------------
/services/workshop/crapi/mechanic/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/crapi/merchant/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/crapi/merchant/urls.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 |
15 | """
16 | merchant URL Configuration
17 | The `urlpatterns` list routes URLs to views.
18 | """
19 | from django.urls import include, re_path
20 |
21 | import crapi.merchant.views as merchant_views
22 |
23 | urlpatterns = [
24 | re_path(r"contact_mechanic$", merchant_views.ContactMechanicView.as_view()),
25 | re_path(
26 | r"service_requests/(?P[^/]+)$",
27 | merchant_views.UserServiceRequestsView.as_view(),
28 | ),
29 | ]
30 |
--------------------------------------------------------------------------------
/services/workshop/crapi/migrations/0002_order_transaction_id.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 2.2.28 on 2023-03-28 04:29
2 |
3 | from django.db import migrations, models
4 | import uuid
5 |
6 |
7 | class Migration(migrations.Migration):
8 |
9 | dependencies = [
10 | ("crapi", "0001_initial"),
11 | ]
12 |
13 | operations = [
14 | migrations.AddField(
15 | model_name="order",
16 | name="transaction_id",
17 | field=models.CharField(default=uuid.uuid4, max_length=255),
18 | ),
19 | ]
20 |
--------------------------------------------------------------------------------
/services/workshop/crapi/migrations/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/crapi/models.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/crapi/shop/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/crapi/tests.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 |
15 | # Create your tests here.
16 |
--------------------------------------------------------------------------------
/services/workshop/crapi/urls.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 |
15 | """
16 | crAPI URL Configuration
17 | The `urlpatterns` list routes URLs to URLConf.
18 | """
19 | from django.urls import path, include
20 |
21 | urlpatterns = [
22 | path("api/mechanic/", include("crapi.mechanic.urls")),
23 | path("api/merchant/", include("crapi.merchant.urls")),
24 | path("api/shop/", include("crapi.shop.urls")),
25 | path("api/management/", include("crapi.user.urls")),
26 | ]
27 |
--------------------------------------------------------------------------------
/services/workshop/crapi/user/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/crapi/user/sapps.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 |
15 | """
16 | Configuration for user application
17 | """
18 | from django.apps import AppConfig
19 |
20 |
21 | class UserConfig(AppConfig):
22 | """
23 | Stores all meta data of user application
24 | """
25 |
26 | name = "user"
27 |
--------------------------------------------------------------------------------
/services/workshop/crapi/user/urls.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 |
15 | """
16 | shop URL Configuration
17 | The `urlpatterns` list routes URLs to views.
18 | """
19 | from django.urls import include, re_path
20 |
21 | import crapi.user.views as user_views
22 |
23 | urlpatterns = [
24 | # Do not change the order of URLs
25 | re_path(r"users/all$", user_views.AdminUserView.as_view()),
26 | ]
27 |
--------------------------------------------------------------------------------
/services/workshop/crapi_site/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/crapi_site/wsgi.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 |
15 | """
16 | WSGI config for crapi_site project.
17 |
18 | It exposes the WSGI callable as a module-level variable named ``application``.
19 |
20 | For more information on this file, see
21 | https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
22 | """
23 |
24 | import os
25 |
26 | from django.core.wsgi import get_wsgi_application
27 |
28 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "crapi_site.settings")
29 |
30 | application = get_wsgi_application()
31 |
--------------------------------------------------------------------------------
/services/workshop/dev-requirements.txt:
--------------------------------------------------------------------------------
1 | coverage==7.4.1
2 | unittest-xml-reporting==3.2.0
--------------------------------------------------------------------------------
/services/workshop/health.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | SCHEME="http"
3 | if [ "$TLS_ENABLED" = "true" ] || [ "$TLS_ENABLED" = "1" ]; then
4 | SCHEME="https"
5 | fi
6 | curl -k $SCHEME://0.0.0.0:${SERVER_PORT:-8000}/workshop/health_check/
7 |
--------------------------------------------------------------------------------
/services/workshop/requirements.txt:
--------------------------------------------------------------------------------
1 | bcrypt==4.1.2
2 | Django~=4.1.13
3 | cryptography==40.0.2
4 | django-cors-headers==4.0.0
5 | django-db-cascade-2==0.3.5
6 | django-environ==0.10.0
7 | django-extended-choices==1.3.3
8 | django-extensions==3.2.3
9 | django-health-check==3.17.0
10 | djangorestframework==3.14.0
11 | django-sslserver==0.22
12 | djongo==1.3.6 #max version for django 4.1.13
13 | sqlparse==0.2.4 #djongo-dependency
14 | psycopg2==2.9.9
15 | PyJWT==2.7.0
16 | pymongo==3.13.0
17 | pyOpenSSL==23.1.1
18 | requests==2.30.0
19 | Werkzeug==2.0.3
20 | Faker==22.1.0
21 | gunicorn==21.2.0
22 | coverage==7.4.1
23 | unittest-xml-reporting==3.2.0
24 | black==24.4.2
25 |
--------------------------------------------------------------------------------
/services/workshop/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the “License”);
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an “AS IS” BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | from setuptools import setup, find_packages
17 |
18 | with open("requirements.txt") as f:
19 | requirements = f.readlines()
20 |
21 | setup(
22 | name="crapi_site",
23 | version="1.0",
24 | packages=find_packages(),
25 | install_requires=requirements,
26 | )
27 |
--------------------------------------------------------------------------------
/services/workshop/utils/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
--------------------------------------------------------------------------------
/services/workshop/utils/helper.py:
--------------------------------------------------------------------------------
1 | from base64 import b64encode
2 |
3 |
4 | def basic_auth(username, password=""):
5 | token = b64encode(f"{username}:{password}".encode("utf-8")).decode("ascii")
6 | return f"Basic {token}"
7 |
--------------------------------------------------------------------------------
/services/workshop/utils/logging.py:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed under the Apache License, Version 2.0 (the “License”);
3 | # you may not use this file except in compliance with the License.
4 | # You may obtain a copy of the License at
5 | #
6 | # http://www.apache.org/licenses/LICENSE-2.0
7 | #
8 | # Unless required by applicable law or agreed to in writing, software
9 | # distributed under the License is distributed on an “AS IS” BASIS,
10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | # See the License for the specific language governing permissions and
12 | # limitations under the License.
13 |
14 |
15 | import logging
16 |
17 |
18 | def log_error(url, params, status_code, message):
19 | """
20 | :param url: The URL of the request API.
21 | :param params: Parameters of the request if any
22 | :param status_code: The return status code of the API
23 | :param message: The message of the error.
24 | :return:
25 | """
26 | logging.getLogger().error(f"{url} - {params} - {status_code} -{message}")
27 |
--------------------------------------------------------------------------------
/services/workshop/utils/return-qr-code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OWASP/crAPI/9cdb8b932d80667bb01e4b806955512dfca3bf98/services/workshop/utils/return-qr-code.png
--------------------------------------------------------------------------------