Commit 97c9a6c3 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed package names and missing classes

parent 1366e2c0
package org.crophub.auth.server.listener;
import org.crophub.auth.server.model.impl.OAuthClientDetails;
import org.crophub.auth.server.service.impl.JdbcClientDetailsService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CreateClientDetailsListener implements InitializingBean {
@Autowired
private JdbcClientDetailsService clientDetailsService;
public static final String DEFAULT_CLIENT_DETAILS_ID = "CropHub";
@Override
public void afterPropertiesSet() throws Exception {
System.out.println("CREATE CLIENT DETAILS LISTENER START.");
if (!clientDetailsService.isExists(DEFAULT_CLIENT_DETAILS_ID)) {
createClientDetails();
}
System.out.println("CREATE CLIENT DETAILS LISTENER END.");
}
private void createClientDetails() {
OAuthClientDetails clientDetails = new OAuthClientDetails();
clientDetails.setClientId(DEFAULT_CLIENT_DETAILS_ID);
clientDetails.setClientSecret("0xcafebabe");
clientDetails.setScope("read,write");
clientDetails.setAuthorizedGrantTypes("authorization_code");
clientDetails.setAuthorities("ROLE_USER");
clientDetailsService.addClientDetails(clientDetails);
}
}
package org.crophub.auth.server.message;
import java.io.Serializable;
public class SimpleMessage implements Serializable {
private String status;
private String message;
@SuppressWarnings("unused")
private SimpleMessage() {
}
public SimpleMessage(String status, String message) {
this.status = status;
this.message = message;
}
public String getStatus() {
return status;
}
public String getMessage() {
return message;
}
@Override
public String toString() {
return "{\"status\"=\"" + status + "\",\"message\"=\"" + message + "\"}";
}
@Override
public int hashCode() {
return toString().hashCode();
}
@Override
public boolean equals(Object obj) {
return obj instanceof SimpleMessage && toString().equals(obj.toString());
}
}
\ No newline at end of file
......@@ -40,6 +40,7 @@
<aspectj.version>1.7.2</aspectj.version>
<spring.framework.version>3.2.4.RELEASE</spring.framework.version>
<spring.security.version>3.1.4.RELEASE</spring.security.version>
<spring.security.oauth2.version>1.0.0.RELEASE</spring.security.oauth2.version>
<spring.data.core.version>1.5.1.RELEASE</spring.data.core.version>
<spring.data.jpa.version>1.3.2.RELEASE</spring.data.jpa.version>
......@@ -353,6 +354,11 @@
<artifactId>owasp-java-html-sanitizer</artifactId>
<version>r209</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>${spring.security.oauth2.version}</version>
</dependency>
</dependencies>
<build>
......
package org.genesys2.server.exception;
public class ApplicationException extends Exception {
private static final long serialVersionUID = -3217910093684680094L;
public ApplicationException() {
super();
}
public ApplicationException(String message) {
super(message);
}
public ApplicationException(String message, Throwable cause) {
super(message, cause);
}
public ApplicationException(Throwable cause) {
super(cause);
}
}
package org.genesys2.server.exception;
public class AuthorizationException extends ApplicationException {
private static final long serialVersionUID = -5675061342788496576L;
public AuthorizationException() {
super();
}
public AuthorizationException(String message) {
super(message);
}
public AuthorizationException(String message, Throwable cause) {
super(message, cause);
}
public AuthorizationException(Throwable cause) {
super(cause);
}
}
package org.crophub.auth.server.exception;
package org.genesys2.server.exception;
public class NoSuchTokenException extends RuntimeException {
public NoSuchTokenException(String message) {
private static final long serialVersionUID = 2802799300427359826L;
public NoSuchTokenException(String message) {
super(message);
}
......
package org.crophub.auth.server.model.impl;
package org.genesys2.server.model.oauth;
import org.crophub.auth.server.model.HibernateModel;
import javax.persistence.*;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import org.genesys2.server.model.HibernateModel;
@Entity
@Table(name = "oauth_access_token")
public class OAuthAccessToken implements HibernateModel {
......
package org.crophub.auth.server.model.impl;
import org.crophub.auth.server.model.BusinessModel;
package org.genesys2.server.model.oauth;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.genesys2.server.model.BusinessModel;
@Entity
@Table(name = "authorities")
public class OAuthAuthorities extends BusinessModel{
......
package org.crophub.auth.server.model.impl;
package org.genesys2.server.model.oauth;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.util.StringUtils;
import javax.persistence.*;
import java.util.*;
@Entity
@Table(name = "oauth_client_details")
public class OAuthClientDetails implements ClientDetails {
......
package org.crophub.auth.server.model.impl;
package org.genesys2.server.model.oauth;
import org.crophub.auth.server.model.HibernateModel;
import javax.persistence.*;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import org.genesys2.server.model.HibernateModel;
@Entity
@Table(name = "oauth_client_token")
public class OAuthClientToken implements HibernateModel {
......
package org.crophub.auth.server.model.impl;
package org.genesys2.server.model.oauth;
import org.crophub.auth.server.model.HibernateModel;
import javax.persistence.*;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import org.genesys2.server.model.HibernateModel;
@Entity
@Table(name = "oauth_code")
public class OAuthCode implements HibernateModel {
......
package org.crophub.auth.server.model.impl;
package org.genesys2.server.model.oauth;
import org.crophub.auth.server.model.HibernateModel;
import javax.persistence.*;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import org.genesys2.server.model.HibernateModel;
@Entity
@Table(name = "oauth_refresh_token")
public class OAuthRefreshToken implements HibernateModel {
......
package org.crophub.auth.server.persistence;
package org.genesys2.server.persistence.domain;
import org.crophub.auth.server.model.impl.OAuthAccessToken;
import org.genesys2.server.model.oauth.OAuthAccessToken;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;
......
package org.crophub.auth.server.persistence;
package org.genesys2.server.persistence.domain;
import org.crophub.auth.server.model.impl.OAuthAuthorities;
import org.genesys2.server.model.oauth.OAuthAuthorities;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;
......
package org.crophub.auth.server.persistence;
package org.genesys2.server.persistence.domain;
import org.crophub.auth.server.model.impl.OAuthClientDetails;
import org.genesys2.server.model.oauth.OAuthClientDetails;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;
......
package org.crophub.auth.server.persistence;
package org.genesys2.server.persistence.domain;
import org.crophub.auth.server.model.impl.OAuthClientToken;
import org.genesys2.server.model.oauth.OAuthClientToken;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;
......
package org.crophub.auth.server.persistence;
package org.genesys2.server.persistence.domain;
import org.crophub.auth.server.model.impl.OAuthCode;
import org.genesys2.server.model.oauth.OAuthCode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;
......
package org.crophub.auth.server.persistence;
package org.genesys2.server.persistence.domain;
import org.crophub.auth.server.model.impl.OAuthRefreshToken;
import org.genesys2.server.model.oauth.OAuthRefreshToken;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;
......
package org.crophub.auth.server.service.impl;
package org.genesys2.server.service.impl;
import java.util.ArrayList;
import java.util.List;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.crophub.auth.server.model.impl.OAuthClientDetails;
import org.crophub.auth.server.persistence.OAuthClientDetailsPersistence;
import org.genesys2.server.model.oauth.OAuthClientDetails;
import org.genesys2.server.persistence.domain.OAuthClientDetailsPersistence;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
import org.springframework.security.oauth2.provider.*;
import org.springframework.security.oauth2.provider.ClientAlreadyExistsException;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.ClientRegistrationService;
import org.springframework.security.oauth2.provider.NoSuchClientException;
import org.springframework.util.Assert;
import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.List;
public class JdbcClientDetailsService implements ClientDetailsService, ClientRegistrationService {
private static final Log logger = LogFactory.getLog(JdbcClientDetailsService.class);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment