diff --git a/client/src/app/auth/auth.actions.ts b/client/src/app/auth/auth.actions.ts index e661950bc51ec035d596e7ffa4c36e4b32a96d04..429574a4716d4c1db8670e584eed302f148fa37f 100644 --- a/client/src/app/auth/auth.actions.ts +++ b/client/src/app/auth/auth.actions.ts @@ -14,8 +14,6 @@ import { UserProfile } from './user-profile.model'; export const login = createAction('[Auth] Login'); export const logout = createAction('[Auth] Logout'); export const authSuccess = createAction('[Auth] Auth Success'); -export const authRefreshSuccess = createAction('[Auth] Auth Refresh Success'); export const loadUserProfileSuccess = createAction('[Auth] Load User Profile Success', props<{ userProfile: UserProfile }>()); -export const loadUserRoleSuccess = createAction('[Auth] Load User Roles Success', props<{ userRoles: string[] }>()); -export const loadTokenSuccess = createAction('[Auth] Load Token Success', props<{ token: string }>()); +export const loadUserRolesSuccess = createAction('[Auth] Load User Roles Success', props<{ userRoles: string[] }>()); export const openEditProfile = createAction('[Auth] Edit Profile'); diff --git a/client/src/app/auth/auth.effects.ts b/client/src/app/auth/auth.effects.ts index d063947da7551c674cc504b300992724de67da7f..bdb76a950fa0644e54dba3b9add95f7061e884bd 100644 --- a/client/src/app/auth/auth.effects.ts +++ b/client/src/app/auth/auth.effects.ts @@ -49,24 +49,9 @@ export class AuthEffects { ofType(authActions.authSuccess), switchMap(() => from(this.keycloak.loadUserProfile()) .pipe( - withLatestFrom(this.keycloak.getToken()), - switchMap(([userProfile, token]) => [ + switchMap(userProfile => [ authActions.loadUserProfileSuccess({ userProfile }), - authActions.loadUserRoleSuccess({ userRoles: this.keycloak.getUserRoles() }), - authActions.loadTokenSuccess({ token }) - ]) - ) - ) - ) - ); - - authRefreshSuccess$ = createEffect(() => - this.actions$.pipe( - ofType(authActions.authRefreshSuccess), - switchMap(() => from(this.keycloak.getToken()) - .pipe( - switchMap(token => [ - authActions.loadTokenSuccess({ token }) + authActions.loadUserRolesSuccess({ userRoles: this.keycloak.getUserRoles() }), ]) ) ) diff --git a/client/src/app/auth/auth.reducer.ts b/client/src/app/auth/auth.reducer.ts index d181f446c38c60c85008746abebb2709a3d74e64..a516f9c9c9056ed0f26ded6a598f88a91a7f198b 100644 --- a/client/src/app/auth/auth.reducer.ts +++ b/client/src/app/auth/auth.reducer.ts @@ -16,14 +16,12 @@ export interface State { isAuthenticated: boolean; userProfile: UserProfile; userRoles: string[]; - token: string; } export const initialState: State = { isAuthenticated: false, userProfile: null, - userRoles: [], - token: null + userRoles: [] }; export const authReducer = createReducer( @@ -36,17 +34,12 @@ export const authReducer = createReducer( ...state, userProfile })), - on(authActions.loadUserRoleSuccess, (state, { userRoles }) => ({ + on(authActions.loadUserRolesSuccess, (state, { userRoles }) => ({ ...state, userRoles - })), - on(authActions.loadTokenSuccess, (state, { token }) => ({ - ...state, - token })) ); export const selectIsAuthenticated = (state: State) => state.isAuthenticated; export const selectUserProfile = (state: State) => state.userProfile; export const selectUserRoles = (state: State) => state.userRoles; -export const selectToken = (state: State) => state.token; diff --git a/client/src/app/auth/auth.selector.ts b/client/src/app/auth/auth.selector.ts index 3822a9055d1df824dc751a6ac04ecf7b6c9ea866..8b0e4f734c29257f3e9004722e5aa802053d6a6d 100644 --- a/client/src/app/auth/auth.selector.ts +++ b/client/src/app/auth/auth.selector.ts @@ -27,8 +27,3 @@ export const selectUserRoles = createSelector( selectAuthState, fromAuth.selectUserRoles ); - -export const selectToken = createSelector( - selectAuthState, - fromAuth.selectToken -); diff --git a/client/src/app/auth/init.keycloak.ts b/client/src/app/auth/init.keycloak.ts index d488a979c2829b954546d7bdd3ff2e9d974961f1..a15e68f1179781fb93e1a25d10e3c9a35e3e8ed8 100644 --- a/client/src/app/auth/init.keycloak.ts +++ b/client/src/app/auth/init.keycloak.ts @@ -24,9 +24,6 @@ export function initializeKeycloak(keycloak: KeycloakService, store: Store<{ }>, if (event.type === KeycloakEventType.OnAuthSuccess) { store.dispatch(keycloakActions.authSuccess()); } - if (event.type === KeycloakEventType.OnAuthRefreshSuccess) { - store.dispatch(keycloakActions.authRefreshSuccess()); - } if (event.type === KeycloakEventType.OnAuthRefreshError) { store.dispatch(keycloakActions.login()); } diff --git a/client/src/app/instance/search/components/result/download.component.html b/client/src/app/instance/search/components/result/download.component.html index bca9d41fafe78bb124dfef68a6541f3d811666f4..5fc5683f29b4555db3b7c386b4ac69443785314b 100644 --- a/client/src/app/instance/search/components/result/download.component.html +++ b/client/src/app/instance/search/components/result/download.component.html @@ -18,15 +18,15 @@ <p>Download results just here:</p> </div> <div class="col"> - <a *ngIf="getConfigDownloadResultFormat('download_csv')" (click)="click($event, getUrl('csv'), 'csv')" class="btn btn-outline-primary" title="Download results in CSV format"> + <a *ngIf="getConfigDownloadResultFormat('download_csv')" [href]="getUrl('csv')" (click)="click($event, getUrl('csv'), 'csv')" class="btn btn-outline-primary" title="Download results in CSV format"> <i class="fas fa-file-csv"></i> CSV </a> - <a *ngIf="getConfigDownloadResultFormat('download_ascii')" (click)="click($event, getUrl('ascii'), 'txt')" class="btn btn-outline-primary" title="Download results in ASCII format"> + <a *ngIf="getConfigDownloadResultFormat('download_ascii')" [href]="getUrl('ascii')" (click)="click($event, getUrl('ascii'), 'txt')" class="btn btn-outline-primary" title="Download results in ASCII format"> <i class="fas fa-file"></i> ASCII </a> - <a *ngIf="getConfigDownloadResultFormat('download_vo')" (click)="click($event, getUrl('votable'), 'xml')" class="btn btn-outline-primary" title="Download results in VO format"> + <a *ngIf="getConfigDownloadResultFormat('download_vo')" [href]="getUrl('votable')" (click)="click($event, getUrl('votable'), 'xml')" class="btn btn-outline-primary" title="Download results in VO format"> <i class="fas fa-file"></i> VOtable </a> @@ -41,7 +41,7 @@ <p>Download archive files just here:</p> </div> <div class="col"> - <a (click)="click($event, getUrlArchive(), 'zip')" class="btn btn-outline-primary" title="Download an archive with all files"> + <a [href]="getUrlArchive()" (click)="click($event, getUrlArchive(), 'zip')" class="btn btn-outline-primary" title="Download an archive with all files"> <i class="fas fa-archive"></i> Files archive </a> </div> diff --git a/client/src/app/instance/search/containers/result.component.ts b/client/src/app/instance/search/containers/result.component.ts index 9254082a3f03e5b3da3a26c1bd75a1062d1af818..f62ca538ed8b10b2a94be5d2b5e3778e92907a22 100644 --- a/client/src/app/instance/search/containers/result.component.ts +++ b/client/src/app/instance/search/containers/result.component.ts @@ -20,7 +20,6 @@ import * as searchActions from '../../store/actions/search.actions'; import * as searchSelector from '../../store/selectors/search.selector'; import * as sampActions from '../../store/actions/samp.actions'; import * as sampSelector from '../../store/selectors/samp.selector'; -import * as authSelector from 'src/app/auth/auth.selector'; @Component({ selector: 'app-result', diff --git a/client/src/app/instance/shared-search/components/datatable/renderer/download-renderer.component.html b/client/src/app/instance/shared-search/components/datatable/renderer/download-renderer.component.html index da86483575a96e40ec8973a9697a489c60ca7ae6..ad2ae4dd7e841767556c40e6e838c75b69eb9608 100644 --- a/client/src/app/instance/shared-search/components/datatable/renderer/download-renderer.component.html +++ b/client/src/app/instance/shared-search/components/datatable/renderer/download-renderer.component.html @@ -1,4 +1,4 @@ -<a (click)="click($event)" [ngClass]="{'btn btn-outline-primary btn-sm': (config.display=='text-button' || config.display=='icon-button' || config.display=='icon-text-btn')}"> +<a [href]="getHref()" (click)="click($event)" [ngClass]="{'btn btn-outline-primary btn-sm': (config.display=='text-button' || config.display=='icon-button' || config.display=='icon-text-btn')}"> <span *ngIf="config.display === 'icon-button' || config.display === 'icon-text-btn'" class="{{config.icon}}"></span> <span *ngIf="config.display === 'icon-text-btn'"> </span> <span *ngIf="config.display !== 'icon-button'">{{ getText() }}</span> diff --git a/conf-dev/public_key b/conf-dev/public_key index 3c3ba0e8be160eac8c137f66f4bfb969137c8c04..93662776e97bd60d208cea457dd47a5c9e03a2ef 100644 --- a/conf-dev/public_key +++ b/conf-dev/public_key @@ -1,3 +1,3 @@ -----BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1fucBQK34tl8Gx/fefATnpWqW5PVlwMYcJAqgWvmtwNm9ZW/S5HNZZfjW1S9BOJLfudCM83WHrAwGixgHKI310YXg+6BI9qn2Gnge1GC3JtKZx6UdcxZFAYmlhY0QGL5QxGR58DkEj6l/FDrwAHyVkC5sLqDMiYsqO7CA1uJLtF8yUrCyHvI4TR+kk5ZSM94/osg6eGxGSYA89u+qhG5tz5YCFgiRUNxuAEucsz8XiEfNVAz5kdYgsR4+LtmqECfczpwcJrAu7yDxs3rQPjBqFdGqEehALHX9vq71VEYe5Id2P7ddik3byHa0a21Q0RuVhMYwGrLiMLJCXqxE1YMuwIDAQAB +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg0yRIw1yfb6rQLWWmaZgyzXlYCRX8C8TkFH2MmU6PXTrSSwG3r1N5lAKhxFlWCZaTVhWNaYsYGG7l1DwJVrZ2U4Gc7lFADn0ltV/tGwxWJiEwfl/2eMcRZ7L8yToqqL0M8PJ3mPSVjaYlUAFFlB2SOiyQE8uszM9pUO5ZayN4YBs4i6o7ONnOp0e3p6LZ1yM9Bmff4bsuzdIBIAM2Zg0UWdJ646a+AcwZTaPIW1Z/GsufEoNxnN7Wh6wudDWxJ+lDUoZ1m3qNT2x9eUi0K62leWTNwl7ZsOx8l79UJJ+WD+CwylqmXneKUddIPtjlfrRggx3kp3uUTna/BzQUqGJXwIDAQAB -----END PUBLIC KEY----- diff --git a/docker-compose.yml b/docker-compose.yml index 482db6739fd0955000d4d0dc26d19b1500fbcb39..ee412b76725a54d72cfad75ec8636d000a5842f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,7 @@ services: SSO_AUTH_URL: "http://localhost:8180/auth" SSO_REALM: "anis" SSO_CLIENT_ID: "anis-client" - TOKEN_ENABLED: 1 + TOKEN_ENABLED: 0 TOKEN_PUBLIC_KEY_FILE: /mnt/public_key TOKEN_ADMIN_ROLE: anis_admin ports: