📄 chal.java
字号:
/** * Copyright (C) 2003-2004 Funambol * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package sync4j.framework.core;/** * This class represents an authentication challenge element. It corresponds * to the <Chal> element in SyncML representation DTD * * @author Stefano Fornari @ Funambol * @see Credential * * @version $Id: Chal.java,v 1.2 2004/05/28 16:06:00 luigiafassina Exp $ */public final class Chalimplements java.io.Serializable { // ------------------------------------------------------------ Private data private Meta meta = null; // ------------------------------------------------------------ Constructors /** For serialization purposes */ protected Chal() {} /** * Constructs a new Chal object. * * @param meta The meta object - NOT NULL * */ public Chal (final Meta meta) { this.meta = meta; String type = meta.getType(); String format = meta.getFormat(); NextNonce nextNonce = meta.getNextNonce(); if (type == null) { throw new IllegalArgumentException( "The authentication type cannot be null"); } if (format == null) { if (type.equalsIgnoreCase(Constants.AUTH_TYPE_BASIC)) { meta.setFormat(Constants.FORMAT_B64); } else { throw new IllegalArgumentException( "The authentication format cannot be null"); } } } // ---------------------------------------------------------- Public methods /** * Returns the nextNonce property or null * * @return the nextNonce property or null */ public NextNonce getNextNonce() { return meta.getNextNonce(); } /** * Returns the authentication type * * @return authentication type. */ public String getType() { return meta.getType(); } /** * Returns the authentication format * * @return format the authentication format */ public String getFormat() { return meta.getFormat(); } /** * Creates a basic authentication challange. * This will have type = Constants.AUTH_TYPE_BASIC and * format = Constants.FORMAT_B64 * * @return the newly created AuthenticationChallange */ public static Chal getBasicChal() { Meta meta = new Meta(); meta.setType(Constants.AUTH_TYPE_BASIC); meta.setFormat(Constants.FORMAT_B64); meta.setNextNonce(null); return new Chal(meta); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -