001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.activemq.transport.amqp.sasl; 018 019import org.apache.qpid.proton.engine.Sasl; 020 021/** 022 * A SASL Mechanism implements this interface in order to provide the 023 * AmqpAuthenticator with the means of providing authentication services 024 * in the SASL handshake step. 025 */ 026public interface SaslMechanism { 027 028 /** 029 * Perform the SASL processing for this mechanism type. 030 * 031 * @param sasl 032 * the SASL server that has read the incoming SASL exchange. 033 */ 034 void processSaslStep(Sasl sasl); 035 036 /** 037 * @return the User Name extracted from the SASL echange or null if none. 038 */ 039 String getUsername(); 040 041 /** 042 * @return the Password extracted from the SASL echange or null if none. 043 */ 044 String getPassword(); 045 046 /** 047 * @return the name of the implemented SASL mechanism. 048 */ 049 String getMechanismName(); 050 051 /** 052 * @return true if the SASL processing failed during a step. 053 */ 054 boolean isFailed(); 055 056 /** 057 * @return a failure error to explain why the mechanism failed. 058 */ 059 String getFailureReason(); 060 061}