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

Implemented authorization logic in the client side #16

Merged
merged 6 commits into from
Jan 4, 2025
Merged
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
2 changes: 2 additions & 0 deletions backend/src/AuthService/AuthService.Api/GraphQL/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ public async Task<UserDto> GetUserByUsername(string username, [Service] GetUserB

return result.Response;
}

public bool IsAuthenticated() => _httpContextAccessor.HttpContext?.User.Identity?.IsAuthenticated ?? false;
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
context: ./frontend
dockerfile: Dockerfile
ports:
- "4000:4000"
- "4200:80"
depends_on:
post-service:
condition: service_healthy
Expand Down
33 changes: 19 additions & 14 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ COPY package*.json ./
RUN npm install

COPY . .

RUN npm run build -- --configuration production

FROM node:20.17.0
WORKDIR /app

COPY --from=build /app/dist /app/dist
COPY package*.json ./

RUN npm install --production

EXPOSE 4000

CMD ["npm", "run", "serve:ssr:frontend"]
RUN npm run build --prod

FROM nginx:1.21.3-alpine
COPY --from=build /app/dist/frontend /usr/share/nginx/html

RUN echo 'server {\
listen 80;\
listen [::]:80;\
server_name localhost;\
location / {\
root /usr/share/nginx/html/browser;\
try_files $uri $uri/ /index.html;\
index index.html index.htm;\
}\
error_page 500 502 503 504 /50x.html;\
location = /50x.html {\
root /usr/share/nginx/html/browser;\
}\
}' > /etc/nginx/conf.d/default.conf
7 changes: 1 addition & 6 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@
"styles": [
"src/styles.scss"
],
"scripts": [],
"server": "src/main.server.ts",
"prerender": true,
"ssr": {
"entry": "server.ts"
}
"scripts": []
},
"configurations": {
"production": {
Expand Down
Loading
Loading