samlcompliantuniqueticketidgenerator.java
来自「CAS在Tomcat中实现单点登录项目,单点登录(Single Sign On 」· Java 代码 · 共 47 行
JAVA
47 行
/* * 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.util;import org.jasig.cas.util.annotation.NotNull;import org.opensaml.artifact.SAMLArtifact;import org.opensaml.artifact.SAMLArtifactType0002;import org.opensaml.artifact.URI;/** * Unique Ticket Id Generator compliant with the SAML 1.1 specification for * artifacts. This should also be compliant with the SAML 2 specification. * * @author Scott * @version $Revision: 42053 $ $Date: 2007-06-10 09:17:55 -0400 (Sun, 10 Jun 2007) $ * @since 3.0 */public final class SamlCompliantUniqueTicketIdGenerator implements UniqueTicketIdGenerator { /** SAML defines the source id as the server name. */ @NotNull private final String sourceLocation; /** Random generator to construct the AssertionHandle. */ private final RandomStringGenerator randomStringGenerator = new DefaultRandomStringGenerator( 20); public SamlCompliantUniqueTicketIdGenerator(final String sourceId) { this.sourceLocation = sourceId; } /** * We ignore prefixes for SAML compliance. */ public String getNewTicketId(final String prefix) { final SAMLArtifact samlArtifact = new SAMLArtifactType0002( this.randomStringGenerator.getNewStringAsBytes(), new URI( this.sourceLocation)); return samlArtifact.encode(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?