httpbasedservicecredentials.java

来自「CAS在Tomcat中实现单点登录项目,单点登录(Single Sign On 」· Java 代码 · 共 75 行

JAVA
75
字号
/* * Copyright 2007 The JA-SIG Collaborative. All rights reserved. See license * distributed with this file and available online at * http://www.ja-sig.org/products/cas/overview/license/ */package org.jasig.cas.authentication.principal;import java.net.URL;import org.springframework.util.Assert;/** * The Credentials representing an HTTP-based service. HTTP-based services (such * as web applications) are often represented by the URL entry point of the * application. *  * @author Scott Battaglia * @version $Revision: 1.3 $ $Date: 2007/04/24 13:01:51 $ * @since 3.0 */public class HttpBasedServiceCredentials implements Credentials {    /** Unique Serializable ID. */    private static final long serialVersionUID = 3904681574350991665L;    /** The callbackURL to check that identifies the application. */    private final URL callbackUrl;    /** String form of callbackUrl; */    private final String callbackUrlAsString;    /**     * Constructor that takes the URL of the HTTP-based service and creates the     * Credentials object. Caches the value of URL.toExternalForm so updates to     * the URL will not be reflected in a call to toString().     *      * @param callbackUrl the URL representing the service     * @throws IllegalArgumentException if the callbackUrl is null.     */    public HttpBasedServiceCredentials(final URL callbackUrl) {        Assert.notNull(callbackUrl, "callbackUrl cannot be null");        this.callbackUrl = callbackUrl;        this.callbackUrlAsString = callbackUrl.toExternalForm();    }    /**     * @return Returns the callbackUrl.     */    public final URL getCallbackUrl() {        return this.callbackUrl;    }    /**     * Returns the String version of the URL, based on the original URL     * provided. i.e. this caches the value of URL.toExternalForm()     */    public final String toString() {        return this.callbackUrlAsString;    }    public boolean equals(final Object object) {        if (object == null) {            return false;        }        if (!this.getClass().equals(object.getClass())) {            return false;        }        final HttpBasedServiceCredentials c = (HttpBasedServiceCredentials) object;        return c.getCallbackUrl().equals(this.getCallbackUrl());    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?