mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Fixes for authentication (awaiting fixes in EPerson REST endpoint)
This commit is contained in:
@@ -12,22 +12,23 @@ import { ResponseParsingService } from '../data/parsing.service';
|
||||
import { RestRequest } from '../data/request.models';
|
||||
import { AuthType } from './auth-type';
|
||||
import { AuthStatus } from './models/auth-status.model';
|
||||
import { NormalizedAuthStatus } from './models/normalized-auth-status.model';
|
||||
|
||||
@Injectable()
|
||||
export class AuthResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
|
||||
|
||||
protected objectFactory = AuthObjectFactory;
|
||||
protected toCache = false;
|
||||
protected toCache = true;
|
||||
|
||||
constructor(@Inject(GLOBAL_CONFIG) protected EnvConfig: GlobalConfig,
|
||||
protected objectCache: ObjectCacheService,) {
|
||||
protected objectCache: ObjectCacheService) {
|
||||
super();
|
||||
}
|
||||
|
||||
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
|
||||
if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links) && (data.statusCode === '200' || data.statusCode === 'OK')) {
|
||||
const response = this.process<AuthStatus, AuthType>(data.payload, request.href);
|
||||
return new AuthStatusResponse(response[Object.keys(response)[0]][0], data.statusCode);
|
||||
const response = this.process<NormalizedAuthStatus, AuthType>(data.payload, request.href);
|
||||
return new AuthStatusResponse(response, data.statusCode);
|
||||
} else {
|
||||
return new AuthStatusResponse(data.payload as AuthStatus, data.statusCode);
|
||||
}
|
||||
|
Reference in New Issue
Block a user