public CloudbeesPrincipalImpl(OauthToken token) { this.email = token.email; this.scopes = token.getScopes().toArray(new String[token.getScopes().size()]); this.accounts = token.listAccounts().toArray(new String[token.listAccounts().size()]); this.clientId = token.clientId; this.accessToken = token.accessToken; this.userAccountRole = token.userAccountRole; this.authenticationMethod = Secure.Authenticator.OAUTH; this.secured = true; }
/** * Return true if the given scope is fond in the scopes granted with this token */ @JsonIgnore @CheckReturnValue public boolean validateScope(String scope){ if(scope == null){ return false; } for(String s: getScopes()){ if(s.trim().equals(scope)){ return true; } } return false; }
/** * Return true if the given scope is fond in the scopes granted with this token */ @JsonIgnore @CheckReturnValue public boolean validateScope(String scope){ if(scope == null){ return false; } for(String s: getScopes()){ if(s.trim().equals(scope)){ return true; } } return false; }