Skip to content
Snippets Groups Projects
Commit a1e1aa3e authored by François Agneray's avatar François Agneray
Browse files

Direct download for private dataset => done

parent 076be863
No related branches found
No related tags found
2 merge requests!29Develop,!10Download private dataset
...@@ -14,8 +14,6 @@ import { UserProfile } from './user-profile.model'; ...@@ -14,8 +14,6 @@ import { UserProfile } from './user-profile.model';
export const login = createAction('[Auth] Login'); export const login = createAction('[Auth] Login');
export const logout = createAction('[Auth] Logout'); export const logout = createAction('[Auth] Logout');
export const authSuccess = createAction('[Auth] Auth Success'); 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 loadUserProfileSuccess = createAction('[Auth] Load User Profile Success', props<{ userProfile: UserProfile }>());
export const loadUserRoleSuccess = createAction('[Auth] Load User Roles Success', props<{ userRoles: string[] }>()); export const loadUserRolesSuccess = createAction('[Auth] Load User Roles Success', props<{ userRoles: string[] }>());
export const loadTokenSuccess = createAction('[Auth] Load Token Success', props<{ token: string }>());
export const openEditProfile = createAction('[Auth] Edit Profile'); export const openEditProfile = createAction('[Auth] Edit Profile');
...@@ -49,24 +49,9 @@ export class AuthEffects { ...@@ -49,24 +49,9 @@ export class AuthEffects {
ofType(authActions.authSuccess), ofType(authActions.authSuccess),
switchMap(() => from(this.keycloak.loadUserProfile()) switchMap(() => from(this.keycloak.loadUserProfile())
.pipe( .pipe(
withLatestFrom(this.keycloak.getToken()), switchMap(userProfile => [
switchMap(([userProfile, token]) => [
authActions.loadUserProfileSuccess({ userProfile }), authActions.loadUserProfileSuccess({ userProfile }),
authActions.loadUserRoleSuccess({ userRoles: this.keycloak.getUserRoles() }), authActions.loadUserRolesSuccess({ 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 })
]) ])
) )
) )
......
...@@ -16,14 +16,12 @@ export interface State { ...@@ -16,14 +16,12 @@ export interface State {
isAuthenticated: boolean; isAuthenticated: boolean;
userProfile: UserProfile; userProfile: UserProfile;
userRoles: string[]; userRoles: string[];
token: string;
} }
export const initialState: State = { export const initialState: State = {
isAuthenticated: false, isAuthenticated: false,
userProfile: null, userProfile: null,
userRoles: [], userRoles: []
token: null
}; };
export const authReducer = createReducer( export const authReducer = createReducer(
...@@ -36,17 +34,12 @@ export const authReducer = createReducer( ...@@ -36,17 +34,12 @@ export const authReducer = createReducer(
...state, ...state,
userProfile userProfile
})), })),
on(authActions.loadUserRoleSuccess, (state, { userRoles }) => ({ on(authActions.loadUserRolesSuccess, (state, { userRoles }) => ({
...state, ...state,
userRoles userRoles
})),
on(authActions.loadTokenSuccess, (state, { token }) => ({
...state,
token
})) }))
); );
export const selectIsAuthenticated = (state: State) => state.isAuthenticated; export const selectIsAuthenticated = (state: State) => state.isAuthenticated;
export const selectUserProfile = (state: State) => state.userProfile; export const selectUserProfile = (state: State) => state.userProfile;
export const selectUserRoles = (state: State) => state.userRoles; export const selectUserRoles = (state: State) => state.userRoles;
export const selectToken = (state: State) => state.token;
...@@ -27,8 +27,3 @@ export const selectUserRoles = createSelector( ...@@ -27,8 +27,3 @@ export const selectUserRoles = createSelector(
selectAuthState, selectAuthState,
fromAuth.selectUserRoles fromAuth.selectUserRoles
); );
export const selectToken = createSelector(
selectAuthState,
fromAuth.selectToken
);
...@@ -24,9 +24,6 @@ export function initializeKeycloak(keycloak: KeycloakService, store: Store<{ }>, ...@@ -24,9 +24,6 @@ export function initializeKeycloak(keycloak: KeycloakService, store: Store<{ }>,
if (event.type === KeycloakEventType.OnAuthSuccess) { if (event.type === KeycloakEventType.OnAuthSuccess) {
store.dispatch(keycloakActions.authSuccess()); store.dispatch(keycloakActions.authSuccess());
} }
if (event.type === KeycloakEventType.OnAuthRefreshSuccess) {
store.dispatch(keycloakActions.authRefreshSuccess());
}
if (event.type === KeycloakEventType.OnAuthRefreshError) { if (event.type === KeycloakEventType.OnAuthRefreshError) {
store.dispatch(keycloakActions.login()); store.dispatch(keycloakActions.login());
} }
......
...@@ -18,15 +18,15 @@ ...@@ -18,15 +18,15 @@
<p>Download results just here:</p> <p>Download results just here:</p>
</div> </div>
<div class="col"> <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 <i class="fas fa-file-csv"></i> CSV
</a> </a>
&nbsp; &nbsp;
<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 <i class="fas fa-file"></i> ASCII
</a> </a>
&nbsp; &nbsp;
<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 <i class="fas fa-file"></i> VOtable
</a> </a>
&nbsp; &nbsp;
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<p>Download archive files just here:</p> <p>Download archive files just here:</p>
</div> </div>
<div class="col"> <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 <i class="fas fa-archive"></i> Files archive
</a> </a>
</div> </div>
......
...@@ -20,7 +20,6 @@ import * as searchActions from '../../store/actions/search.actions'; ...@@ -20,7 +20,6 @@ import * as searchActions from '../../store/actions/search.actions';
import * as searchSelector from '../../store/selectors/search.selector'; import * as searchSelector from '../../store/selectors/search.selector';
import * as sampActions from '../../store/actions/samp.actions'; import * as sampActions from '../../store/actions/samp.actions';
import * as sampSelector from '../../store/selectors/samp.selector'; import * as sampSelector from '../../store/selectors/samp.selector';
import * as authSelector from 'src/app/auth/auth.selector';
@Component({ @Component({
selector: 'app-result', selector: 'app-result',
......
<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-button' || config.display === 'icon-text-btn'" class="{{config.icon}}"></span>
<span *ngIf="config.display === 'icon-text-btn'">&nbsp;</span> <span *ngIf="config.display === 'icon-text-btn'">&nbsp;</span>
<span *ngIf="config.display !== 'icon-button'">{{ getText() }}</span> <span *ngIf="config.display !== 'icon-button'">{{ getText() }}</span>
......
-----BEGIN PUBLIC KEY----- -----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1fucBQK34tl8Gx/fefATnpWqW5PVlwMYcJAqgWvmtwNm9ZW/S5HNZZfjW1S9BOJLfudCM83WHrAwGixgHKI310YXg+6BI9qn2Gnge1GC3JtKZx6UdcxZFAYmlhY0QGL5QxGR58DkEj6l/FDrwAHyVkC5sLqDMiYsqO7CA1uJLtF8yUrCyHvI4TR+kk5ZSM94/osg6eGxGSYA89u+qhG5tz5YCFgiRUNxuAEucsz8XiEfNVAz5kdYgsR4+LtmqECfczpwcJrAu7yDxs3rQPjBqFdGqEehALHX9vq71VEYe5Id2P7ddik3byHa0a21Q0RuVhMYwGrLiMLJCXqxE1YMuwIDAQAB MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg0yRIw1yfb6rQLWWmaZgyzXlYCRX8C8TkFH2MmU6PXTrSSwG3r1N5lAKhxFlWCZaTVhWNaYsYGG7l1DwJVrZ2U4Gc7lFADn0ltV/tGwxWJiEwfl/2eMcRZ7L8yToqqL0M8PJ3mPSVjaYlUAFFlB2SOiyQE8uszM9pUO5ZayN4YBs4i6o7ONnOp0e3p6LZ1yM9Bmff4bsuzdIBIAM2Zg0UWdJ646a+AcwZTaPIW1Z/GsufEoNxnN7Wh6wudDWxJ+lDUoZ1m3qNT2x9eUi0K62leWTNwl7ZsOx8l79UJJ+WD+CwylqmXneKUddIPtjlfrRggx3kp3uUTna/BzQUqGJXwIDAQAB
-----END PUBLIC KEY----- -----END PUBLIC KEY-----
...@@ -34,7 +34,7 @@ services: ...@@ -34,7 +34,7 @@ services:
SSO_AUTH_URL: "http://localhost:8180/auth" SSO_AUTH_URL: "http://localhost:8180/auth"
SSO_REALM: "anis" SSO_REALM: "anis"
SSO_CLIENT_ID: "anis-client" SSO_CLIENT_ID: "anis-client"
TOKEN_ENABLED: 1 TOKEN_ENABLED: 0
TOKEN_PUBLIC_KEY_FILE: /mnt/public_key TOKEN_PUBLIC_KEY_FILE: /mnt/public_key
TOKEN_ADMIN_ROLE: anis_admin TOKEN_ADMIN_ROLE: anis_admin
ports: ports:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment