Starting to flesh out some of the model and endpoints. I've added

several "empty.txt" files in order to push the complete directory layout
to Git - it won't push empty directories.
pull/59/head
Amanda Anganes 2011-12-09 16:09:41 -05:00
parent edd6f7a0f3
commit 6078c68f96
7 changed files with 449 additions and 91 deletions

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

102
.project
View File

@ -1,51 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OpenIDConnect</name>
<comment></comment>
<projects>
<project>Servers</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ajdt.core.ajbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.ajdt.ui.ajnature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>com.springsource.sts.roo.core.nature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OpenIDConnect</name>
<comment></comment>
<projects>
<project>Servers</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ajdt.core.ajbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.ajdt.ui.ajnature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>com.springsource.sts.roo.core.nature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,8 +1,103 @@
package org.mitre.openid.connect.model;
import javax.persistence.Entity;
@Entity
public class IdToken {
}
package org.mitre.openid.connect.model;
import javax.persistence.Entity;
/*
* TODO: This class needs to be encoded as a JWT
*/
@Entity
public class IdToken {
private String iss;
private String user_id;
private String aud;
private String exp;
private String iso29115;
private String nonce;
private String auth_time;
/**
* @return the iss
*/
public String getIss() {
return iss;
}
/**
* @param iss the iss to set
*/
public void setIss(String iss) {
this.iss = iss;
}
/**
* @return the user_id
*/
public String getUser_id() {
return user_id;
}
/**
* @param user_id the user_id to set
*/
public void setUser_id(String user_id) {
this.user_id = user_id;
}
/**
* @return the aud
*/
public String getAud() {
return aud;
}
/**
* @param aud the aud to set
*/
public void setAud(String aud) {
this.aud = aud;
}
/**
* @return the exp
*/
public String getExp() {
return exp;
}
/**
* @param exp the exp to set
*/
public void setExp(String exp) {
this.exp = exp;
}
/**
* @return the iso29115
*/
public String getIso29115() {
return iso29115;
}
/**
* @param iso29115 the iso29115 to set
*/
public void setIso29115(String iso29115) {
this.iso29115 = iso29115;
}
/**
* @return the nonce
*/
public String getNonce() {
return nonce;
}
/**
* @param nonce the nonce to set
*/
public void setNonce(String nonce) {
this.nonce = nonce;
}
/**
* @return the auth_time
*/
public String getAuth_time() {
return auth_time;
}
/**
* @param auth_time the auth_time to set
*/
public void setAuth_time(String auth_time) {
this.auth_time = auth_time;
}
}

View File

@ -1,8 +1,232 @@
package org.mitre.openid.connect.model;
import javax.persistence.Entity;
@Entity
public class UserInfo {
}
package org.mitre.openid.connect.model;
import javax.persistence.Entity;
@Entity
public class UserInfo {
private String user_id;
private String name;
private String given_name;
private String family_name;
private String middle_name;
private String nickname;
private String profile;
private String picture;
private String website;
private String email;
private Boolean verified;
private String gender;
private String zoneinfo;
private String locale;
private String phone_number;
private Address address;
private String updated_time;
/**
* @return the user_id
*/
public String getUser_id() {
return user_id;
}
/**
* @param user_id the user_id to set
*/
public void setUser_id(String user_id) {
this.user_id = user_id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the given_name
*/
public String getGiven_name() {
return given_name;
}
/**
* @param given_name the given_name to set
*/
public void setGiven_name(String given_name) {
this.given_name = given_name;
}
/**
* @return the family_name
*/
public String getFamily_name() {
return family_name;
}
/**
* @param family_name the family_name to set
*/
public void setFamily_name(String family_name) {
this.family_name = family_name;
}
/**
* @return the middle_name
*/
public String getMiddle_name() {
return middle_name;
}
/**
* @param middle_name the middle_name to set
*/
public void setMiddle_name(String middle_name) {
this.middle_name = middle_name;
}
/**
* @return the nickname
*/
public String getNickname() {
return nickname;
}
/**
* @param nickname the nickname to set
*/
public void setNickname(String nickname) {
this.nickname = nickname;
}
/**
* @return the profile
*/
public String getProfile() {
return profile;
}
/**
* @param profile the profile to set
*/
public void setProfile(String profile) {
this.profile = profile;
}
/**
* @return the picture
*/
public String getPicture() {
return picture;
}
/**
* @param picture the picture to set
*/
public void setPicture(String picture) {
this.picture = picture;
}
/**
* @return the website
*/
public String getWebsite() {
return website;
}
/**
* @param website the website to set
*/
public void setWebsite(String website) {
this.website = website;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the verified
*/
public Boolean getVerified() {
return verified;
}
/**
* @param verified the verified to set
*/
public void setVerified(Boolean verified) {
this.verified = verified;
}
/**
* @return the gender
*/
public String getGender() {
return gender;
}
/**
* @param gender the gender to set
*/
public void setGender(String gender) {
this.gender = gender;
}
/**
* @return the zoneinfo
*/
public String getZoneinfo() {
return zoneinfo;
}
/**
* @param zoneinfo the zoneinfo to set
*/
public void setZoneinfo(String zoneinfo) {
this.zoneinfo = zoneinfo;
}
/**
* @return the locale
*/
public String getLocale() {
return locale;
}
/**
* @param locale the locale to set
*/
public void setLocale(String locale) {
this.locale = locale;
}
/**
* @return the phone_number
*/
public String getPhone_number() {
return phone_number;
}
/**
* @param phone_number the phone_number to set
*/
public void setPhone_number(String phone_number) {
this.phone_number = phone_number;
}
/**
* @return the address
*/
public Address getAddress() {
return address;
}
/**
* @param address the address to set
*/
public void setAddress(Address address) {
this.address = address;
}
/**
* @return the updated_time
*/
public String getUpdated_time() {
return updated_time;
}
/**
* @param updated_time the updated_time to set
*/
public void setUpdated_time(String updated_time) {
this.updated_time = updated_time;
}
}

View File

@ -1,10 +1,23 @@
package org.mitre.openid.connect.web;
import org.mitre.openid.connect.model.IdToken;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/checkid")
public class CheckIDEndpoint {
@RequestMapping("/")
public ModelAndView checkID(@RequestParam("id_token") String idToken, ModelAndView mav) {
IdToken token = new IdToken();
//TODO: Set claims
return new ModelAndView("jsonIdTokenView", "checkId", token);
}
}

View File

@ -1,10 +1,25 @@
package org.mitre.openid.connect.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/userinfo")
public class UserInfoEndpoint {
}
package org.mitre.openid.connect.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/userinfo")
public class UserInfoEndpoint {
@RequestMapping("/")
public ModelAndView getInfo(@RequestParam("access_token") String accessToken, @RequestParam("schema") String schema, ModelAndView mav) {
UserInfo userInfo = new UserInfo();
//populate with info
//If returning JSON
return new ModelAndView("jsonUserInfoView", "userInfo", userInfo);
//TODO: If returning JWT?
}
}

View File

@ -19,10 +19,21 @@
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
<beans:property name="order" value="2"/>
</beans:bean>
<context:component-scan base-package="org.mitre.openid" />
<!-- Resolve views based on string names -->
<beans:bean class="org.springframework.web.servlet.view.BeanNameViewResolver" >
<beans:property name="order" value="1"/>
</beans:bean>
<!-- json view, capable of converting any POJO to json format -->
<beans:bean id="jsonView" class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"/>
<!-- JSON views for each type of model object -->
<beans:bean id="jsonUserInfoView" class="org.mitre.openid.connect.model.serializer.JSONUserInfoView"/>
<beans:bean id="jsonIdTokenView" class="org.mitre.openid.connect.model.serializer.JSONIdTokenView"/>
</beans:beans>