package com.zyeeda.framework.openid.consumer.shiro;

import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authc.AuthenticationToken;
import org.openid4java.discovery.Identifier;

public class OpenIdAuthenticationToken implements AuthenticationToken {

	private static final long serialVersionUID = 7305997052059544245L;
	
	private Identifier id;
	private String userId;
	
	public OpenIdAuthenticationToken(Identifier id) {
		this.id = id;
		
		String url = this.id.getIdentifier();
		this.userId = StringUtils.substringAfterLast(url, "id=");
	}

	@Override
	public Object getPrincipal() {
		if (id == null) {
			return null;
		}
		return this.userId;
	}

	@Override
	public Object getCredentials() {
		return null;
	}

}

@@ -344,33 +344,8 @@
 %0A%09%0D%0A
-%09private Identifier id;%0D%0A
 %09pri
@@ -424,29 +424,8 @@
  %7B%0D%0A
-%09%09this.id = id;%0D%0A%09%09%0D%0A
 %09%09St
@@ -435,21 +435,16 @@
 g url = 
-this.
 id.getId
@@ -516,24 +516,108 @@
 %22id=%22);%0D%0A%09%7D%0D
+%0A%09%0D%0A%09public OpenIdAuthenticationToken(String userId) %7B%0D%0A%09%09this.userId = userId;%0D%0A%09%7D%0D
 %0A%0D%0A%09@Overrid
@@ -656,51 +656,8 @@
  %7B%0D%0A
-%09%09if (id == null) %7B%0D%0A%09%09%09return null;%0D%0A%09%09%7D%0D%0A
 %09%09re

add another constructor