oauth2 models creation via factory

pull/676/head
koboldeveloper 2014-09-02 16:45:31 -04:00
parent 380d31c5cd
commit b1c317a713
4 changed files with 356 additions and 0 deletions

View File

@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright 2014 The MITRE Corporation
* and the MIT Kerberos and Internet Trust Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package org.mitre.oauth2.model;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
/**
* @author jricher
*
*/
public interface AuthenticationHolderEntity {
Long getId();
void setId(Long id);
Long getOwnerId();
void setOwnerId(Long owner_id);
OAuth2Authentication getAuthentication();
void setAuthentication(OAuth2Authentication authentication);
}

View File

@ -0,0 +1,109 @@
/*******************************************************************************
* Copyright 2014 The MITRE Corporation
* and the MIT Kerberos and Internet Trust Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package org.mitre.oauth2.model;
import java.text.ParseException;
import java.util.Date;
import java.util.Set;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import com.nimbusds.jwt.JWT;
/**
* @author jricher
*
*/
public interface OAuth2AccessTokenEntity extends OAuth2AccessToken {
/**
* @return the id
*/
Long getId();
/**
* @param id the id to set
*/
void setId(Long id);
/**
* The authentication in place when this token was created.
* @return the authentication
*/
AuthenticationHolderEntity getAuthenticationHolder();
/**
* @param authentication the authentication to set
*/
void setAuthenticationHolder(AuthenticationHolderEntity authenticationHolder);
/**
* @return the client
*/
ClientDetailsEntity getClient();
/**
* @param client the client to set
*/
void setClient(ClientDetailsEntity client);
/**
* Set the "value" of this Access Token
*
* @param value the JWT string
* @throws ParseException if "value" is not a properly formatted JWT string
*/
void setValue(String value) throws ParseException;
void setExpiration(Date expiration);
void setTokenType(String tokenType);
void setRefreshToken(OAuth2RefreshTokenEntity refreshToken);
@Override
OAuth2RefreshTokenEntity getRefreshToken();
void setScope(Set<String> scope);
/**
* @return the idToken
*/
OAuth2AccessTokenEntity getIdToken();
/**
* @param idToken the idToken to set
*/
void setIdToken(OAuth2AccessTokenEntity idToken);
/**
* @return the idTokenString
*/
String getIdTokenString();
/**
* @return the jwtValue
*/
JWT getJwt();
/**
* @param jwtValue the jwtValue to set
*/
void setJwt(JWT jwt);
}

View File

@ -0,0 +1,94 @@
/*******************************************************************************
* Copyright 2014 The MITRE Corporation
* and the MIT Kerberos and Internet Trust Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package org.mitre.oauth2.model;
import java.text.ParseException;
import java.util.Date;
import org.springframework.security.oauth2.common.OAuth2RefreshToken;
import com.nimbusds.jwt.JWT;
/**
* @author jricher
*
*/
public interface OAuth2RefreshTokenEntity extends OAuth2RefreshToken {
/**
* @return the id
*/
Long getId();
/**
* @param id the id to set
*/
void setId(Long id);
/**
* The authentication in place when the original access token was
* created
*
* @return the authentication
*/
AuthenticationHolderEntity getAuthenticationHolder();
/**
* @param authentication the authentication to set
*/
void setAuthenticationHolder(AuthenticationHolderEntity authenticationHolder);
/**
* Set the value of this token as a string. Parses the string into a JWT.
* @param value
* @throws ParseException if the value is not a valid JWT string
*/
void setValue(String value) throws ParseException;
Date getExpiration();
void setExpiration(Date expiration);
/**
* Has this token expired?
* @return true if it has a timeout set and the timeout has passed
*/
boolean isExpired();
/**
* @return the client
*/
ClientDetailsEntity getClient();
/**
* @param client the client to set
*/
void setClient(ClientDetailsEntity client);
/**
* Get the JWT object directly
* @return the jwt
*/
JWT getJwt();
/**
* @param jwt the jwt to set
*/
void setJwt(JWT jwt);
}

View File

@ -0,0 +1,113 @@
/*******************************************************************************
* Copyright 2014 The MITRE Corporation
* and the MIT Kerberos and Internet Trust Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package org.mitre.oauth2.model;
/**
* @author jricher
*
*/
public interface SystemScope {
/**
* @return the id
*/
Long getId();
/**
* @param id the id to set
*/
void setId(Long id);
/**
* @return the value
*/
String getValue();
/**
* @param value the value to set
*/
void setValue(String value);
/**
* @return the description
*/
String getDescription();
/**
* @param description the description to set
*/
void setDescription(String description);
/**
* @return the icon
*/
String getIcon();
/**
* @param icon the icon to set
*/
void setIcon(String icon);
/**
* @return the allowDynReg
*/
boolean isAllowDynReg();
/**
* @param allowDynReg the allowDynReg to set
*/
void setAllowDynReg(boolean allowDynReg);
/**
* @return the defaultScope
*/
boolean isDefaultScope();
/**
* @param defaultScope the defaultScope to set
*/
void setDefaultScope(boolean defaultScope);
/**
* @return the isStructured status
*/
boolean isStructured();
/**
* @param structured the structured to set
*/
void setStructured(boolean structured);
String getStructuredParamDescription();
/**
* @param isStructured the isStructured to set
*/
void setStructuredParamDescription(String d);
/**
* @return the structuredValue
*/
String getStructuredValue();
/**
* @param structuredValue the structuredValue to set
*/
void setStructuredValue(String structuredValue);
}