Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

88 task prepare for development in openshift #89

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
Expand Down Expand Up @@ -109,6 +105,12 @@
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
},
{
"path": "detect_secrets.filters.regex.should_exclude_file",
"pattern": [
"go.sum"
]
}
],
"results": {
Expand All @@ -118,8 +120,7 @@
"filename": "README.md",
"hashed_secret": "112bb791304791ddcf692e29fd5cf149b35fea37",
"is_verified": false,
"line_number": 25,
"is_secret": false
"line_number": 25
}
],
"driven/groups/adapter.go": [
Expand All @@ -128,8 +129,7 @@
"filename": "driven/groups/adapter.go",
"hashed_secret": "36c48d6ac9d10902792fa78b9c2d7d535971c2cc",
"is_verified": false,
"line_number": 79,
"is_secret": false
"line_number": 79
}
],
"driven/notifications/adapter.go": [
Expand All @@ -138,8 +138,7 @@
"filename": "driven/notifications/adapter.go",
"hashed_secret": "6a4894e38dc141a1016ce7351b226c7f0fb4fc5c",
"is_verified": false,
"line_number": 89,
"is_secret": false
"line_number": 89
}
],
"driver/web/auth.go": [
Expand All @@ -148,16 +147,14 @@
"filename": "driver/web/auth.go",
"hashed_secret": "17857c14001a341fdbd7f611889a6add1be7e9d8",
"is_verified": false,
"line_number": 61,
"is_secret": false
"line_number": 61
},
{
"type": "Secret Keyword",
"filename": "driver/web/auth.go",
"hashed_secret": "fca71afec681b7c2932610046e8e524820317e47",
"is_verified": false,
"line_number": 77,
"is_secret": false
"line_number": 77
}
],
"main.go": [
Expand All @@ -166,10 +163,9 @@
"filename": "main.go",
"hashed_secret": "a23be006fadbd85ce60d87580e3f127c58a824ce",
"is_verified": false,
"line_number": 104,
"is_secret": false
"line_number": 107
}
]
},
"generated_at": "2023-05-10T09:03:53Z"
"generated_at": "2023-07-06T21:06:08Z"
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Prepare for development in OpenShift [#88](https://github.com/rokwire/lms-building-block/issues/88)

## [1.9.2] - 2023-05-16
### Fixed
- Fix filtering by NetID [#85](https://github.com/rokwire/lms-building-block/issues/85)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ LMS_TEST_NET_ID | < string > | yes | Net ID of test user
LMS_TEST_USER_ID2 | < string > | yes | Account ID of second test user
LMS_TEST_NET_ID2 | < string > | yes | Net ID of second test user
LMS_NOTIFICATIONS_BB_HOST | < url > | yes | Notifications BB base URL
LMS_CORE_BB_CURRENT_HOST | < url > | yes | Core current BB host URL
LMS_CORE_BB_CORE_HOST | < url > | yes | Core BB core host URL
LMS_CORE_BB_HOST | < url > | yes | Core BB host URL
LMS_GROUPS_BB_HOST | < url > | yes | Groups BB host URL
LMS_SERVICE_URL | < url > | yes | URL where this application is being hosted
LMS_SERVICE_ACCOUNT_ID | < string > | yes | ID of Service Account for LMS BB

### Run Application

Expand Down
25 changes: 25 additions & 0 deletions app-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"app_secret": {
"LMS_MONGO_AUTH": "<mongo auth url>",
"LMS_INTERNAL_API_KEY": "<internal api key>",
"LMS_PRIV_KEY": "<service account priv key>"
},
"app_config":{
"LMS_PORT": "5000",
"LMS_MONGO_DATABASE": "<mongo database>",
"LMS_MONGO_TIMEOUT": "",
"LMS_DEFAULT_CACHE_EXPIRATION_SECONDS": "<default cache expiration seconds>",
"LMS_CANVAS_BASE_URL": "<canvas base url>",
"LMS_CANVAS_TOKEN_TYPE": "<canvas token type>",
"LMS_CANVAS_TOKEN": "<canvas token>",
"LMS_GROUPS_BB_HOST": "<groups bb host>",
"LMS_APP_ID": "<app id>",
"LMS_ORG_ID": "<org id>",
"LMS_NOTIFICATIONS_BB_HOST": "<notifications bb host>",
"LMS_CORE_BB_HOST": "<core bb host>",
"LMS_SERVICE_URL": "<service url>",
"LMS_CORE_BB_CURRENT_HOST": "<core bb current host>",
"LMS_CORE_BB_CORE_HOST": "<core bb core host>",
"LMS_SERVICE_ACCOUNT_ID": "<service account id>"
}
}
2 changes: 1 addition & 1 deletion core/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
cacheadapter "lms/driven/cache"
"lms/driven/corebb"

"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/v2/logs"
)

// Application represents the core application code based on hexagonal architecture
Expand Down
2 changes: 1 addition & 1 deletion core/app_apis_administration.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package core
import (
"lms/core/model"

"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/v2/logs"
)

func (app *Application) getNudgesConfig(l *logs.Log) (*model.NudgesConfig, error) {
Expand Down
2 changes: 1 addition & 1 deletion core/app_apis_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package core
import (
"lms/core/model"

"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/v2/logs"
)

func (app *Application) getVersion() string {
Expand Down
2 changes: 1 addition & 1 deletion core/app_nudges.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"time"

"github.com/google/uuid"
"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/v2/logs"
)

type nudgesLogic struct {
Expand Down
2 changes: 1 addition & 1 deletion core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"lms/driven/storage"
"time"

"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/v2/logs"
)

// Services exposes APIs for the driver adapters
Expand Down
4 changes: 2 additions & 2 deletions driven/provider/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"strings"
"time"

"github.com/rokwire/logging-library-go/errors"
"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/v2/errors"
"github.com/rokwire/logging-library-go/v2/logs"
)

// Adapter implements the Provider interface
Expand Down
6 changes: 3 additions & 3 deletions driven/provider/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"log"
"time"

"github.com/rokwire/logging-library-go/errors"
"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/logutils"
"github.com/rokwire/logging-library-go/v2/errors"
"github.com/rokwire/logging-library-go/v2/logs"
"github.com/rokwire/logging-library-go/v2/logutils"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
Expand Down
6 changes: 3 additions & 3 deletions driven/storage/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"strconv"
"time"

"github.com/rokwire/logging-library-go/errors"
"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/logutils"
"github.com/rokwire/logging-library-go/v2/errors"
"github.com/rokwire/logging-library-go/v2/logs"
"github.com/rokwire/logging-library-go/v2/logutils"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo/options"
Expand Down
2 changes: 1 addition & 1 deletion driven/storage/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"log"
"time"

"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/v2/logs"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
Expand Down
2 changes: 1 addition & 1 deletion driven/storage/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"log"
"time"

"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/v2/logs"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
Expand Down
16 changes: 9 additions & 7 deletions driver/web/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"github.com/getkin/kin-openapi/routers"

"github.com/rokwire/core-auth-library-go/v2/tokenauth"
"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/logutils"
"github.com/rokwire/logging-library-go/v2/logs"
"github.com/rokwire/logging-library-go/v2/logutils"

"github.com/gorilla/mux"
httpSwagger "github.com/swaggo/http-swagger"
Expand Down Expand Up @@ -131,7 +131,7 @@ func (we Adapter) wrapFunc(handler http.HandlerFunc) http.HandlerFunc {
}
}

type userAuthFunc = func(*logs.Log, *tokenauth.Claims, http.ResponseWriter, *http.Request) logs.HttpResponse
type userAuthFunc = func(*logs.Log, *tokenauth.Claims, http.ResponseWriter, *http.Request) logs.HTTPResponse

func (we Adapter) userAuthWrapFunc(handler userAuthFunc) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
Expand All @@ -142,7 +142,7 @@ func (we Adapter) userAuthWrapFunc(handler userAuthFunc) http.HandlerFunc {
// validate request
_, err := we.validateRequest(req)
if err != nil {
logObj.RequestErrorAction(w, logutils.ActionValidate, logutils.TypeRequest, nil, err, http.StatusBadRequest, true)
logObj.HTTPResponseErrorAction(logutils.ActionValidate, logutils.TypeRequest, nil, err, http.StatusBadRequest, true)
return
}

Expand Down Expand Up @@ -182,7 +182,7 @@ func (we Adapter) userAuthWrapFunc(handler userAuthFunc) http.HandlerFunc {
}
}

type adminAuthFunc = func(*logs.Log, *tokenauth.Claims, http.ResponseWriter, *http.Request) logs.HttpResponse
type adminAuthFunc = func(*logs.Log, *tokenauth.Claims, http.ResponseWriter, *http.Request) logs.HTTPResponse

func (we Adapter) adminAuthWrapFunc(handler userAuthFunc) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
Expand All @@ -193,7 +193,7 @@ func (we Adapter) adminAuthWrapFunc(handler userAuthFunc) http.HandlerFunc {
// validate request
_, err := we.validateRequest(req)
if err != nil {
logObj.RequestErrorAction(w, logutils.ActionValidate, logutils.TypeRequest, nil, err, http.StatusBadRequest, true)
logObj.HTTPResponseErrorAction(logutils.ActionValidate, logutils.TypeRequest, nil, err, http.StatusBadRequest, true)
return
}

Expand Down Expand Up @@ -237,12 +237,14 @@ type internalAPIKeyAuthFunc = func(http.ResponseWriter, *http.Request)

func (we Adapter) internalAPIKeyAuthWrapFunc(handler internalAPIKeyAuthFunc) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
utils.LogRequest(req)
logObj := we.logger.NewRequestLog(req)
logObj.RequestReceived()

apiKeyAuthenticated := we.auth.internalAuth.check(w, req)

if apiKeyAuthenticated {
handler(w, req)
logObj.RequestComplete()
} else {
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
}
Expand Down
2 changes: 1 addition & 1 deletion driver/web/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"log"
"net/http"

"github.com/rokwire/logging-library-go/logs"
"github.com/rokwire/logging-library-go/v2/logs"
)

// Auth handler
Expand Down
4 changes: 2 additions & 2 deletions driver/web/auth/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"github.com/rokwire/core-auth-library-go/v2/authorization"
"github.com/rokwire/core-auth-library-go/v2/authservice"
"github.com/rokwire/core-auth-library-go/v2/tokenauth"
"github.com/rokwire/logging-library-go/errors"
"github.com/rokwire/logging-library-go/logutils"
"github.com/rokwire/logging-library-go/v2/errors"
"github.com/rokwire/logging-library-go/v2/logutils"
)

// CoreAuth implementation
Expand Down
Loading