001package org.apache.archiva.redback.authentication;
002/*
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 */
020
021import org.apache.archiva.redback.users.User;
022
023import java.io.Serializable;
024
025/**
026 * detail on possible authentication failure.
027 *
028 * @author Olivier Lamy
029 * @since 1.4-M4
030 */
031public class AuthenticationFailureCause
032    implements Serializable
033{
034    private int cause;
035
036    private String message;
037
038    private User user;
039
040    public AuthenticationFailureCause( int cause, String message )
041    {
042        this.cause = cause;
043        this.message = message;
044    }
045
046    public int getCause()
047    {
048        return cause;
049    }
050
051    public void setCause( int cause )
052    {
053        this.cause = cause;
054    }
055
056    public String getMessage()
057    {
058        return message;
059    }
060
061    public void setMessage( String message )
062    {
063        this.message = message;
064    }
065
066    public User getUser()
067    {
068        return user;
069    }
070
071    public AuthenticationFailureCause user ( User user)
072    {
073        this.user = user;
074        return this;
075    }
076
077    public void setUser( User user )
078    {
079        this.user = user;
080    }
081
082    @Override
083    public String toString()
084    {
085        final StringBuilder sb = new StringBuilder();
086        sb.append( "AuthenticationFailureCause" );
087        sb.append( "{cause=" ).append( cause );
088        sb.append( ", message='" ).append( message ).append( '\'' );
089        sb.append( '}' );
090        return sb.toString();
091    }
092}