From 75af5e0fece31611e2e25659b2b1bb84d2ff81d7 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 4 Dec 2012 15:26:55 +0000 Subject: [PATCH] authenticator do not return key so add a message field git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1416991 13f79535-47bb-0310-9956-ffa450edef68 --- .../redback/rest/api/model/ErrorMessage.java | 21 +++++++++++++++++++ .../rest/services/DefaultLoginService.java | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ErrorMessage.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ErrorMessage.java index f635cbdc..d47e7460 100644 --- a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ErrorMessage.java +++ b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ErrorMessage.java @@ -33,6 +33,11 @@ public class ErrorMessage private String[] args; + /** + * @since 2.1 for message without any key + */ + private String message; + private static final String[] EMPTY = new String[0]; public ErrorMessage() @@ -71,4 +76,20 @@ public class ErrorMessage { this.args = args; } + + public String getMessage() + { + return message; + } + + public void setMessage( String message ) + { + this.message = message; + } + + public ErrorMessage message( String message ) + { + this.message = message; + return this; + } } diff --git a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/DefaultLoginService.java b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/DefaultLoginService.java index 53141056..03940bd5 100644 --- a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/DefaultLoginService.java +++ b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/DefaultLoginService.java @@ -155,7 +155,7 @@ public class DefaultLoginService List errorMessages = new ArrayList(); for ( Map.Entry entry : securitySession.getAuthenticationResult().getExceptionsMap().entrySet() ) { - errorMessages.add( new ErrorMessage( entry.getValue() ) ); + errorMessages.add( new ErrorMessage().message( entry.getValue() ) ); } throw new RedbackServiceException( errorMessages );