Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package yakworks.security
import grails.testing.mixin.integration.Integration
import okhttp3.Request
import okhttp3.Response
import spock.lang.Ignore
import spock.lang.Specification

import yakworks.rest.client.OkHttpRestTrait

/**
* test the legacy login with post username and password to login endpoint.
*/
@Ignore
@Integration
class JsonUsernamePasswordLoginSpec extends Specification implements OkHttpRestTrait {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.springframework.http.HttpStatus
import org.springframework.security.oauth2.core.OAuth2AccessToken

import grails.testing.mixin.integration.Integration
import spock.lang.Ignore
import spock.lang.Specification

import yakworks.rest.client.OkAuth
Expand All @@ -16,6 +17,7 @@ import yakworks.security.spring.token.store.TokenStore

import java.time.ZoneId

@Ignore
@Integration
class OpaqueRestApiSpec extends Specification implements OkHttpRestTrait {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ class RallyApiSpringConfig {

http.oauth2Login(withDefaults())

//tokenLegacy for using username/password json in api/login, forwards to api/tokenLegacy which saves random string in db as token
DefaultSecurityConfiguration.addJsonAuthenticationFilter(http, tokenStore)
// Legacy tokenLegacy for using username/password json in api/login, forwards to api/tokenLegacy which saves random string in db as token
// DefaultSecurityConfiguration.addJsonAuthenticationFilter(http, tokenStore)

//enables jwt and oauth
DefaultSecurityConfiguration.applyOauthJwt(http)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,15 @@ trait GormRepo<D> implements ApiCrudRepo<D>, BulkableRepo<D>, ResolvableTypeProv

/**
* wraps get in a trx, usefull for testing. NOT a read only trx like read as that messes with dirty tracking
* Throws NotFoundExeption if null
* @param id the id to get
* @return the retrieved entity
*/
D getWithTrx(Serializable id) {
withTrx {
return (D)gormStaticApi().get(id)
var instance = (D)gormStaticApi().get(id)
RepoUtil.checkFound(instance, id, getEntityClass().simpleName)
return instance
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ class UserInfoExt {
@NullCheck
static Org getOrg(UserInfo userInfo){
Validate.notNull(userInfo.orgId, "userInfo.orgId is null for user:[id:${userInfo.id}, username: ${userInfo.username}]")
return Org.repo.getWithTrx(userInfo.orgId)
try {
return Org.repo.getWithTrx(userInfo.orgId)
} catch(e) {
return null
}

}

static boolean isCustomer(UserInfo self){
Expand Down