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

235 integrate auth usermgmt #242

Merged
merged 28 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9520472
Add sample auth keys
Apr 20, 2020
aee42fa
Helper script for testing auth protected routes
Apr 20, 2020
e5a6765
Add basic result proto models
Apr 20, 2020
680eef9
Add transport proto models
Apr 20, 2020
3b53ae3
Add user proto models
Apr 20, 2020
0a4cbdf
Add dependencies
Apr 20, 2020
2f97e25
Implement auth grpc client and protect routes
Apr 20, 2020
ebe056f
Add ports for auth and usermgmt services
Apr 20, 2020
b9dd112
Add auth and usermgmt microservices
Apr 20, 2020
4dfda0c
Setup of envoy jwtk based authentication
Apr 20, 2020
81e156a
Rewrite authentication microservice
Apr 20, 2020
8ae1d88
Rewrite usermgmt microservice with tests
Apr 20, 2020
9a504f7
Cleanup and compile for typescript downstream clients
Apr 20, 2020
8ce9728
Refactor authentication serice model
Apr 20, 2020
181766c
Refactor usermgmt serice model
Apr 20, 2020
5c96092
Add bazel targets for new type models
Apr 20, 2020
bb37376
Remove dead code
Apr 20, 2020
061c9a5
Bugfix and better error propagation
Apr 20, 2020
ac450d6
First draft for a utility function for parsing grpc metadata
Apr 20, 2020
9980263
Update dependencies for utils
Apr 20, 2020
7097410
Log grpc metadata for testing
Apr 20, 2020
d12adac
Add testing abstractions for starting a mongo container in tests
Apr 20, 2020
cd06d50
Rename authentication to auth
Apr 20, 2020
40432bf
Small fixes of the compose files
Apr 21, 2020
c5d482d
Update changelog
Apr 21, 2020
8bff4b6
Merge branch 'dev' of github.com:bptlab/cepta into 235-integrate-auth…
Apr 21, 2020
97c8e66
Upgrade dependencies
Apr 21, 2020
f2fb302
Update auth and usermgmt test tags
Apr 21, 2020
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
8 changes: 4 additions & 4 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test_suite(
tags = ["smoke"],
tests = [
"//core:smoke",
"//osiris/authentication:smoke",
"//osiris/auth:smoke",
"//osiris/notification:smoke",
"//osiris/query:smoke",
"//osiris/usermgmt:smoke",
Expand All @@ -74,7 +74,7 @@ test_suite(
tags = ["unit"],
tests = [
"//core:unit",
"//osiris/authentication:unit",
"//osiris/auth:unit",
"//osiris/notification:unit",
"//osiris/query:unit",
"//osiris/usermgmt:unit",
Expand All @@ -86,7 +86,7 @@ test_suite(
tags = ["integration"],
tests = [
"//core:integration",
"//osiris/authentication:integration",
"//osiris/auth:integration",
"//osiris/notification:integration",
"//osiris/query:integration",
"//osiris/usermgmt:integration",
Expand All @@ -98,7 +98,7 @@ test_suite(
tags = ["internal"],
tests = [
"//core:internal",
"//osiris/authentication:internal",
"//osiris/auth:internal",
"//osiris/notification:internal",
"//osiris/query:internal",
"//osiris/usermgmt:internal",
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
### [0.3.0] - 2020-04-24
##### Added
- WIP
- [#242](https://github.com/bptlab/cepta/pull/242)
- Abstractions for starting mongo containers in golang tests
- Implement e2e authentication via envoy `http.jwt_authn.v2alpha.JwtAuthentication`
- Utility script for generating private and public RSA keys and a jwk set
- Integration tests for authentication
- Integration of authentication in the frontend
- Add `auth` and `usermgmt` microservices in dev and prod docker env
- [#231](https://github.com/bptlab/cepta/pull/231)
- Track the average speed of transports
- t.b.a.
Expand All @@ -15,6 +22,8 @@ All notable changes to this project will be documented in this file.

##### Changed
- WIP
- [#242](https://github.com/bptlab/cepta/pull/242)
- Complete rewrite of auth and user management microservices
- [#217](https://github.com/bptlab/cepta/pull/217)
- consistent naming of bazel targets

Expand Down
104 changes: 102 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ http_archive(
sha256 = "b6670f9f43faa66e3009488bbd909bc7bc46a5a9661a33f6bc578068d1837f37",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.3.0/rules_nodejs-1.3.0.tar.gz"],
)

#@unused
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")

Expand Down Expand Up @@ -132,6 +133,7 @@ FLINK_VERSION = "1.9.0"
SCALA_VERSION = "2.11"

RULES_JVM_EXTERNAL_TAG = "3.2"

RULES_JVM_EXTERNAL_SHA = "82262ff4223c5fda6fb7ff8bd63db8131b51b413d26eb49e3131037e79e324af"

http_archive(
Expand Down Expand Up @@ -789,8 +791,8 @@ go_repository(
go_repository(
name = "com_github_romnnn_bsonpb",
importpath = "github.com/romnnn/bsonpb",
sum = "h1:Id1oYhizudmN8jN+74D2u9mahka6zaZgcrPWIMEp3BA=",
version = "v0.0.0-20200304155412-6da328480240",
sum = "h1:/8PmZgpI8+QeKJj+2VqBJILvYrKBdwFFxZJ1M6alZGc=",
version = "v0.0.3",
)

go_repository(
Expand All @@ -799,3 +801,101 @@ go_repository(
sum = "h1:1s6q1ZYyBLbh+1YrcXKaugZ6u5MSq9R763oVpkwNU2I=",
version = "v0.1.1",
)

go_repository(
name = "com_github_google_uuid",
importpath = "github.com/google/uuid",
sum = "h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=",
version = "v1.1.1",
)

go_repository(
name = "com_github_testcontainers_testcontainers_go",
importpath = "github.com/testcontainers/testcontainers-go",
sum = "h1:u7jCdf130QHBY5KK9xkFzZpkep24Rtl8HdWscMO9H/8=",
version = "v0.5.0",
)

go_repository(
name = "com_github_docker_go_connections",
importpath = "github.com/docker/go-connections",
sum = "h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=",
version = "v0.4.0",
)

go_repository(
name = "com_github_docker_docker",
importpath = "github.com/docker/docker",
sum = "h1:ZuxGvIvF01nfc/G9RJ5Q7Va1zQE2WJyG18Zv3DqCEf4=",
version = "v0.7.3-0.20190506211059-b20a14b54661",
)

go_repository(
name = "com_github_cenkalti_backoff",
importpath = "github.com/cenkalti/backoff",
sum = "h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=",
version = "v2.2.1+incompatible",
)

go_repository(
name = "com_github_docker_distribution",
importpath = "github.com/docker/distribution",
sum = "h1:dvc1KSkIYTVjZgHf/CTC2diTYC8PzhaA5sFISRfNVrE=",
version = "v2.7.1-0.20190205005809-0d3efadf0154+incompatible",
)

go_repository(
name = "com_github_docker_go_units",
importpath = "github.com/docker/go-units",
sum = "h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=",
version = "v0.4.0",
)

go_repository(
name = "com_github_containerd_continuity",
importpath = "github.com/containerd/continuity",
sum = "h1:nXPkFq8X1a9ycY3GYQpFNxHh3j2JgY7zDZfq2EXMIzk=",
version = "v0.0.0-20200413184840-d3ef23f19fbb",
)

go_repository(
name = "com_github_opencontainers_go_digest",
importpath = "github.com/opencontainers/go-digest",
sum = "h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=",
version = "v1.0.0-rc1",
)

go_repository(
name = "com_github_opencontainers_image_spec",
importpath = "github.com/opencontainers/image-spec",
sum = "h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=",
version = "v1.0.1",
)

go_repository(
name = "com_github_opencontainers_runc",
importpath = "github.com/opencontainers/runc",
sum = "h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y=",
version = "v0.1.1",
)

go_repository(
name = "com_github_mitchellh_mapstructure",
importpath = "github.com/mitchellh/mapstructure",
sum = "h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4=",
version = "v1.2.2",
)

go_repository(
name = "com_github_romnnn_flatbson",
importpath = "github.com/romnnn/flatbson",
sum = "h1:5m1VfuKcXWyl3TX6j5xjLdKpSkGlIUB4JRvt+S6/aSk=",
version = "v0.1.0",
)

go_repository(
name = "com_github_lestrrat_go_jwx",
importpath = "github.com/lestrrat-go/jwx",
sum = "h1:1neTPQvRiPRtQpU7QHEEG6dM8A1AFCgi1FGN/2VBucA=",
version = "v0.9.2",
)
7 changes: 7 additions & 0 deletions anubis/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import NprogressContainer from "vue-nprogress/src/NprogressContainer.vue";
import { AuthModule } from "./store/modules/auth";
import { AppModule } from "./store/modules/app";
import { TrainDelayNotification } from "./generated/protobuf/models/events/TrainDelayNotification_pb";
import { COOKIE_THEME } from "./constants";

@Component({
name: "App",
Expand Down Expand Up @@ -60,6 +61,12 @@ export default class App extends Vue {
}

created() {
let theme: number = parseInt(
(this.$cookies.get(COOKIE_THEME) ?? "").toString()
);
if (!isNaN(theme)) {
AppModule.setTheme(theme);
}
this.axios.interceptors.response.use(undefined, err => {
return new Promise((resolve, reject) => {
if (err.status === 401 && err.config && !err.config.__isRetryRequest) {
Expand Down
5 changes: 2 additions & 3 deletions anubis/src/components/AccountDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<script lang="ts">
import AccountDropdownElement from "../components/AccountDropdownElement.vue";
import { Component, Prop, Vue } from "vue-property-decorator";
import { AuthModule } from "../store/modules/auth";

@Component({
name: "AccountDropdown",
Expand All @@ -57,9 +58,7 @@ export default class AccountDropdown extends Vue {
open: boolean = false;

logout() {
this.$store.dispatch("AUTH_LOGOUT").then(() => {
this.$router.push("/login");
});
AuthModule.authLogout();
}

mounted() {}
Expand Down
20 changes: 10 additions & 10 deletions anubis/src/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ import NotificationDropdownElement from "@/components/NotificationDropdownElemen
import EmailDropdownElement from "@/components/EmailDropdownElement.vue";
import AccountDropdown from "@/components/AccountDropdown.vue";
import NavbarDropdown from "@/components/NavbarDropdown.vue";
import { GrpcModule } from "../store/modules/grpc";
import { ReplayerModule } from "../store/modules/replayer";
import { AppModule } from "../store/modules/app";
import axios from "axios";
import BeatLoader from "vue-spinner/src/BeatLoader.vue";
Expand Down Expand Up @@ -323,27 +323,27 @@ export default class NavigationBar extends Vue {
}

get isReplaying() {
return GrpcModule.isReplaying;
return ReplayerModule.isReplaying;
}

get isLoading() {
return AppModule.isLoading;
}

get replayStatus() {
return GrpcModule.replayStatus;
return ReplayerModule.replayStatus;
}

get replayingIds() {
return GrpcModule.replayingOptions?.getIdsList();
return ReplayerModule.replayingOptions?.getIdsList();
}

get replayingType() {
return GrpcModule.replayingOptions?.getType();
return ReplayerModule.replayingOptions?.getType();
}

get replayingSpeed() {
return GrpcModule.replayingOptions?.getSpeed();
return ReplayerModule.replayingOptions?.getSpeed();
}

get isConstantReplay(): boolean {
Expand Down Expand Up @@ -426,15 +426,15 @@ export default class NavigationBar extends Vue {
}

toggleReplay() {
GrpcModule.toggleReplayer(this.replayOptions);
ReplayerModule.toggleReplayer(this.replayOptions);
}

updateReplay() {
GrpcModule.setReplayOptions(this.replayOptions);
ReplayerModule.setReplayOptions(this.replayOptions);
}

resetReplay() {
GrpcModule.resetReplayer();
ReplayerModule.resetReplayer();
}

toggleSearch() {
Expand All @@ -457,7 +457,7 @@ export default class NavigationBar extends Vue {

mounted(): void {
this.updateTime();
GrpcModule.queryReplayer().then(() => {
ReplayerModule.queryReplayer().then(() => {
if (this.replayingSpeed != undefined)
this.replaySpeed = this.replayingSpeed?.getSpeed();
});
Expand Down
2 changes: 1 addition & 1 deletion anubis/src/components/TransportsTableView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<script lang="ts">
import BasicTable from "../components/BasicTable.vue";
import GridTable from "../components/GridTable.vue";
import { GrpcModule } from "../store/modules/grpc";
import { ReplayerModule } from "../store/modules/replayer";
import { Component, Vue, Prop } from "vue-property-decorator";

@Component({
Expand Down
5 changes: 1 addition & 4 deletions anubis/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ Vue.config.productionTip = false;
// Set up progress bar
const nprogress = new NProgress(options);

/*
// Set authentication token if available
const authToken = localStorage.getItem("user-token");
const authToken = Vue.cookies.get("user-token");
if (authToken) {
Vue.axios.defaults.headers.common["Authorization"] = authToken;
}
Expand All @@ -55,8 +54,6 @@ router.beforeEach((to, from, next) => {
}
});

*/

new Vue({
nprogress,
router,
Expand Down
Loading